Show or Hide SSRS column based on specific parameter value - reporting-services

I am having trouble showing/hiding a column based on parameter value chosen.
How my report is set up:
Parameter: ImportStatus --ImportStatus parameter has three values you can choose from: M, V, E
If I choose ImportStatus value = 'M', then I want the report to display a specific column.
Currently, if I go to Column Visibility screen of a column I want to show/hide, I am able to hide column for all values instead of specific. Any idea how to do this correctly?
My expression:
=IIF(Parameters!ImportStatus.Value = "M",true,false)

The expression
=IIF(Parameters!ImportStatus.Value = "M",true,false)
will give the same result as
=(Parameters!ImportStatus.Value = "M")
The expression you need to give specifies whether or not to hide the column, so to show a column where #ImportStatus = "M", you would simply reverse the logic:
=Not(Parameters!ImportStatus.Value = "M")

Related

VLookup not working on full numbered Value

I created a Google Spreadsheet (File Name Product Test) and I have an ID field on column A which contains the word ID plus some letters and numbers (Example "ID-KNYT-12345"). The KNYT part is different per ID, some KNYT some DMXF etc.
So in column B I added a custom formula (Sample below) which processes the ID. If KNYT only numbers are kept. If DMXF the DMXF part is included plus the numbers.
I then have a vlookup/importrange formula on column C which is supposed to use the converted value in column B to lookup the value from another sheet and retrieve a certain information.
The problem is if the converted value contains all numbers like 12345 the vlookup fails, "Did not find value in lookup evaluation". If the converted value contains letters and numbers like DMXF-25452 the lookup works. If I manually type 12345 on column A the lookup works. Why would the lookup say it didn't find a result when the value is there? More details below
I checked, all cells involved are in format Number>"AUTOMATIC".
I checked, the value 12345 is definitely found on the other sheet (Imported Range)
I checked these values online, I found no hidden characters or spaces
The data is from an email with attached Excel file. I don't download the file, I just click to preview it and copy-paste the entire table over to my Product Test spreadsheet
The custom Formula:
function Convert(Thevalue)
{
Thevalue = Thevalue.toString().replace("ID-KNYT-", "");
Thevalue = Thevalue.toString().replace("ID-DMXF-", "DMXF-");
if (Thevalue == "DMXF-2245"){Thevalue = "Evaluated";}
if (Thevalue == "DMXF-3268"){Thevalue = "Pending";}
return Thevalue;
}
The Vlookup (Not actual sheet url just a sample)
VLOOKUP($B1,IMPORTRANGE("https://docs.google.com/spreadsheets/d/feiugsdfjhsdkjfhiesdfjh-p-dsflkjgsdf/edit#gid=000222333","sheet1!$A:$C"),3,FALSE)
UPDATE: This seem to fix it for me. Looks like if the return value is all numbers and no letters it is a NaN issue
if (!isNaN(Thevalue))
{
return Number(Thevalue);
}
else
{
return Thevalue;
}
Your custom function returns text strings. The vlookup() function does not consider the number 123 and the text string "123" equal. To make it work, convert the lookup keys to text with to_text(), like this:
=vlookup( to_text($B1), Sheet1!$A:$C, columns(Sheet1!$A:$C), false )
As RemcoE33 said, the custom function seems superfluous, because the same thing can be done with a plain vanilla spreadsheet formula that employs regexreplace(), like this:
=arrayformula( regexreplace( to_text(A2:A), "ID(?:-KNYT)?-", "" ) )

How to remove a value from an entire column and past value in new column

I am trying to use google app scripts to remove values from a column but I cannot find the correct method(s) for taking the values from each cell in a column searching them for a specific value, removing that value, and then returning the new values to the same column. Example
I want to remove "A" from every cell in column 2 and paste the new values into the same range. To be specific I am trying to literally remove the letter A from a number.
Use the A1 Notation to select the column you want to edit.
let ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let range = ss.getRange("B:B");
Use .getValues() to obtain the rows of the selected column.
Then map the values in the rows using the String function .slice().
let rows = range.getValues();
// In this case i will slice from the 1st index since you want to remove the 1st letter.
let edited_rows = rows.map(row => [row[0].slice(1)]);
Please mind how I wrapped the return value of my map function in an array. This is because i want my edited_rows array to be 2 dimensional.
In this way i can replace the rows in the selected columns directly with the function .setValues().
range.setValues(edited_rows);
References:
Range Class
Javascript slice

Triggering a checkbox set based on multiple values in mulitple fields FM Pro 15 Adv

We have a situation whereby we need to establish a clausal function querying data from two fields.
We have an 'Item Purchased' field, and five second hand item fields (SH Item 1, SH Item 2, etc). If either (or both) of these fields contain one of a list of specific products by name, a checkbox is enabled (ticked) which in turn triggers conditional formatting.
We have the checkbox and the formatting in place, but I can't find an eloquent means to make an IF query using Case or PatternCount etc to trigger the checkbox - I'm a little out of my depth!
I've attempted (successfully) to use a simple nest of IF statements to trigger the checkbox
but there must be a better way to trigger a 'true' result over a list of values, rather than copying repeating it i.e (Item Bought="Roland"; "Yes"; (sh item 3="Roland"; "Yes"; etc:
If(Item Bought="Orla"; "Yes"; If(sh item 1="Orla"; "Yes"; If(sh item 2="Orla"; "Yes"; If(sh item 3="Orla"; "Yes"; "No")))
I was hoping to learn of a better way to query the presence of a dozen or so discrete values over several discrete fields.
The quick fix for your issue could be:
Let (
values = List ( Item Bought ; SH Item 1 ; SH Item 2 ; SH Item 3 ; SH Item 4 ; SH Item 5 )
;
not IsEmpty ( FilterValues ( "Orla" ; values ) )
)
This will return a result of 1 (True) if any of the listed fields contains the value "Orla", 0 (False) otherwise - so you can use it directly as the formula for conditional formatting.
However, as I stated in a comment above, this is not a good solution overall.
Sounds like you can easiest use an OR operator between the criteria in your IF or CASE statement to get what you want. Also, check out the Filtervalues function as it looks to be relevant to your need.

How to get specific cell value in SSRS grouping?

I am making an SSRS report using SQL Server Report Builder. I have column and row grouping as follows :
I want to pick up the row that is highlighted in the red box below. How do I access that specific cell and display its value in some other table in the report? As you can see the value that I want to access is a column grouping total.
Use custom code:
Function SumLookup(ByVal items As Object()) As Decimal
If items Is Nothing Then
Return Nothing
End If
Dim suma As Decimal = New Decimal()
Dim ct as Integer = New Integer()
suma = 0
For Each item As Object In items
suma += Convert.ToDecimal(item)
Next
return suma
End Function
Then in the cell where you want to reference the value:
=Code.Sumlookup(lookupset("2073/074",Fields!FiscalYear.Value,Fields!Value.Value,"DataSet"))
*
lookup("2073/074",Fields!FiscalYear.Value,Fields!Alfa.Value,"DataSet"))
As the cell you want does not have a specific design time name, you won't be able to reference it directly. You'll have to recalculate the value in your second table. You'll have to determine the criteria but assuming it always the last fiscal year and Particular = fixed percentage... then...
You should be able to do it with something like (untested)...
=SUM(IIF(Fields!FiscalYear.Value = Last(Fields!FiscalYear.Value) AND Fields!.Particular.Value = "Fixed Percentage of Gross Income [c=(axb)]", Fields!Value.Value,0))

SSRS: GetReportParameters and date values

I have an RDL file where I enter two dates, run a query based on that date range to populate a drop-down list and then populate another text field with a default value that is based on the Label of the drop-down list's selected item.
The Data Types are Date/Time for the first two dates, Text for the drop-down list and Text for the last text field. The drop-down list's Value as returned by the query is actually a Date/Time but if I set the Data Type to Date/Time then it does not work as expected when I Preview the report (when I select a value in the list the current selection just reverts back to "<Select a Value>" and nothing is put into the last Text field, regardless of its Data Type).
Anyway, with the drop-down list having a Data Type of Text, all works OK in the Preview.
The problem is that I have custom interface for the reports, and try as I might, I cannot get my own implementation to correctly get the default value for my last Text field.
I noticed that SSRS only wants dates in a certain format and so with some manipulation of the dates I can get the ValidValues for the drop-down list parameter by calling GetReportParameters() with the Values parameter set as follows:
values[0].Name = "fromdate";
values[0].Value = "2011-11-01 00:00:00";
values[0].Label = "";
values[1].Name = "todate";
values[1].Value = "2011-11-30 00:00:00";
values[1].Label = "";
parameters = GetReportParameters("myreport", null, true, values, null);
Following this call, parameters[2] now contains ValidValues and I can populate my own drop-down list in the custom UI.
However, when I need to get the default value for the text field, I cannot seem to get the input values in a format that GetReportParameters() will accept:
values[0].Name = "fromdate";
values[0].Value = "2011-11-01 00:00:00";
values[0].Label = "";
values[1].Name = "todate";
values[1].Value = "2011-11-30 00:00:00";
values[1].Label = "";
values[2].Name = "datelist";
values[2].Label = "The date is 22nd Nov 2011";
values[2].Value = "2011-11-22 00:00:00";
parameters = GetReportParameters("myreport", null, true, values, null);
After this call I expect the parameter for my text field to have a DefaultValues value that I can access but it is 'null' the State is set to HasOutstandingDependencies. Why is this? All of the dependencies have been set - correctly as far as I can see, so what might be the issue?
I realise that I may be getting into difficulties with the conversion of Data Type between Date/Time and Text, but if I try to keep it consistent and use Date/Time throughout then I cannot get it to work even in the RDL's Preview, so I'm not sure that's the way to go either!
Thanks in advance.