Reportviewer regular expression check - asp.net-mvc

In my report viewer i have a table displaying data in different columns. I wanted to have a regular expression to check the content in a textbox of a table to see if it is NULL to place a 0 in the textbox. Currently if there is returned data it is displayed and if not then there is empty space which i would like to replace it with a 0
here is what i had for a regular expression for the textbox:
=IIf(Fields!FirstAmount.Value = " ","0",Fields!FirstAmount.Value)
Any ideas or other ways to resolve this issue.

I resolved my issue using the following expression:
=IIF(Fields!FirstAmount.Value Is Nothing, "0", Fields!FirstAmount.Value)
depending if the First Amount field is null or not it will be replaced by 0 if it is empty and if not it will show its data.

Related

How to Compare lists of values (Sheets)

I am looking to compare cells containing a list of comma separated strings to a column containing solutions made up of comma-separated lists.
My test data
Each cell in the "Test lists" column will need to be checked against every one of the cells in the "Possible Solutions" column. If any exist that contain all of the values of the list we are currently testing, it should return TRUE. Otherwise, FALSE. It is OK if the possible solution contains MORE values, just not less.
The image above contains the best solution to this I have managed to work out so far ... the "Should be" column shows the answer I am expecting.
Any suggestions on other things I might try?
This should work. Paste in cell D2 and drag!
=ARRAYFORMULA(SUM(N(ARRAYFORMULA(
LEN(FILTER($A$2:$A, $A$2:$A<>""))
- LEN(REGEXREPLACE(FILTER($A$2:$A, $A$2:$A<>""), SUBSTITUTE($B2, ", ", "|"), ""))
= LEN(SUBSTITUTE($B2, ", ", ""))
)))) > 0
The general idea here is to extract all test list elements from a given possible solution list, and then check whether the number of characters removed equals the length of the test list. If that's true, then the test list is contained within the solution list.
The inner ARRAYFORMULA() extends that search scheme to every possible solution list (i.e. to all of column A); the outer ARRAYFORMULA(SUM(N(...))) > 0 returns TRUE if any of the possible solutions pass the test.

How to give a cell containing with 'ISREF' a default value in Google Sheets

I am trying to use a formula that uses INDEX function. In order to generalize for all the lines that sometimes may contain information from another sheet and sometimes they may not.
That's why I get an ISREF error within the cells because the corresponding cells in the other sheet can't be referenced.
I want to display a default value instead of the ISREF error message. I tried using ISREF function itself within an IF condition but it doesn't work on the same cell. It only references another cell because it is a cell checking function and it doesn't check the output of a formula.
I tried also ISERROR function but it didn't work also. Here's a snippet of the formula that I am putting within my cell:'
INDEX(Plagesuivi; $Q203; 9)
Plagesuivi is a named range
$Q203 contains the row number (that I fetch dynamically and correctly)
9 is the column number
P.S. The indexing is working fine with cells that do appear is the named range: Plagesuivi
I would go with iferror() like this:
=iferror(INDEX(Plagesuivi;$Q203;9);0)
Or replace the 0 with ""
After trial and error the best way to avoid all sorts of errors is:
= IF($Q203=""; 0; IFERROR(INDEX(Plagesuivi; $Q203; 9); 0))
IFERROR checks for all sorts of unpredictable errrors it is a safe-guard against unpredicted cases where it takes 0 by default.
IF in the second case checks whether the referencing content of Q203 is empty or not, in case it is empty the cell takes 0 by default else it gets the output of the false case formula.

Count Number of Cells with Invalid Data Validation Values

I've been scratching my head at this issue. I have Google sheet with a Data Validation that uses a List from a Range that creates a Drop Down with values listed.
When I type something that isn't found in the list of possible options, it will return the error message saying 'Input must fall within specific range'
I have about a ton of these cells going across the sheet from F2:Z2
All I want to be able to do is count the amount of cells that return this type of error message.
I've tried using COUNTIF, but I am not trying to found instances of a specific text in the box, I'm trying to count the amount of cells that don't pass validation.
I've also tried doing...
=COUNT(IF(ISERROR(F2:Z2),1,""))
However, apparently Sheets doesn't count it as an actual error?
The iserror() function will only return true when the cell contains an error value. Your drop-down list cells do not contain error values but values like Junior Technician 3rd Grade.
To count the values that do not appear in the validation list, compare them directly to the range that holds the allowed values, like this:
=counta( iferror( filter( F2:Z2, isna(match(F2:Z2, DropDownLists!A2:A, 0)) ) ) )

Replacing empty string cells with specific value

as you can see I have a database in SPSS and I encountered a problem where one of the columns has empty cells. Now the problem is that the type of data in that column is string. If it was numeric/integer there are tons of videos showing how to do it but none for string cells. I want to fill the empty string cells with the word "null" or "none" but I can't find a way to do it. Help!
You can use the following syntax:
IF V13 = '' V13 = 'Null'.
EXECUTE.
This syntax translates to something like: "If V13 is blank, make V13 equal to the string value 'Null'.
Just run the below syntax:
DO REPEAT S=V13 V16.
IF S="" S="none"
END REPEAT.
EXECUTE.
Store in S all your string variables. only V13 and V16 are visible on screen, so my example is built around them. But you can put as many as you need.

Loop through fields in rdlc report

I have an Rdlc report
In this report I have a field which takes its values by this expression
(Round(((First(Fields!Occurs.Value) / First(Fields!TotalDistance.Value))* 10000),2)
but in some cases (TotalDistance.Value) = 0 so the previous expression returns Infinity,
So I need to get the next record in case of that field equals 0 ,
If also next field equals 0 , I want to get the next one
I looked for way of getting next record but didn't find
I only found (First , Last) methods,
How can I do that ?
instead of using First or Last if you don't care which record as long as it isn't 0 then couldn't you use an aggregate function. ex:
(Round(((First(Fields!Occurs.Value) / MAX(Fields!TotalDistance.Value))* 10000),2)
you could use Max, Min or Avg to get a value. I am unaware of any way within the rdlc to loop through the records like you are asking.
Another completely different way could be to load the data into a datatable then add a column to contain the calculated value and use some code to calculate the values before being passed to the report.

Resources