I am getting the expression type as null when trying to match values in my payload. How do I get my values to match my json input?enter image description here
enter image description here
Related
In my cloud flow, I need to check each of the date columns and update "ActiveDate" with the column name that is within 7 days of today's date.
So for the sample below I'd hope to populate ActiveDate with the value "Date1"
{
"RPTID": "RPT4072",
"Date1": "2021-07-02",
"Date2": "2021-09-17",
"Date3": "2021-10-22",
"Date4": "2022-02-25",
"Date5": "2022-05-20",
"Date6": "2023-03-07",
"ActiveDate": "",
"ProjectManager": "TBC",
"QuantitySurveyor": "Mr A / Mr B"
}
I feel like I'm going round in circles trying to figure out how to do this. I've tried IF syntax and also the Condition action but can't seem to get the correct logic. Any help is much appreciated.
Below is the source and SELECT from excel.
I have then added a loop and tried to update the date calculation with a variety of options and none have worked.
The screenshot above throws this error:
InvalidTemplate. Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '43252': 'In function 'formatDateTime', the value provided for date time string 'Date3' was not valid. The datetime string must match ISO 8601 format.'.
Here are a couple errors that let me on to trying the integer pointer above:
'The template language expression 'div(sub(ticks(formatDateTime(body('Select')[item()], 'yyyy-MM-dd')),ticks(formatDateTime(substring(utcNow(),0,10),'yyyy-MM-dd'))),864000000000)' cannot be evaluated because property 'Date1' cannot be selected. Array elements can only be selected using an integer index.
'The template language expression 'div(sub(ticks(formatDateTime(variables('dates')[item()], 'yyyy-MM-dd')),ticks(formatDateTime(substring(utcNow(),0,10),'yyyy-MM-dd'))),864000000000)' cannot be evaluated because property 'Date1' cannot be selected. Array elements can only be selected using an integer index.
Unable to process template language expressions in action 'Compose_4' inputs at line '1' and column '43252': 'The template language expression 'items('Apply_to_each')?[item()]' cannot be evaluated because property 'Date1' cannot be selected. Property selection is not supported on values of type 'String'
I feel like it needs some sort of item().value but for the life of me I can't get it..
The tricky part is to calculate the date difference for each date and then update the property in your json object.
Date Difference Calculation
div(sub(ticks(formatDateTime(variables('Result')[item()], 'yyyy-MM-dd')),ticks(formatDateTime(substring(utcNow(),0,10),'yyyy-MM-dd'))),864000000000)
Update Property in Json object
setProperty(variables('result'), 'ActiveDate', variables('FinalDate'))
Let's assume that you have your json object in a variable. I am initialising a variable Result for that. Apart from this you need one variable FinalDate for storing the desired date and another variable Dates for storing your 6 date keys.
Now you need to loop over all date keys and find the date difference for each date and check if it falls in the range -7 <= Dif <= 7. If yes assign the FinalDate object to that particular date. Check the image below.
Now you just need to update you original json object. You ca simply use setProperty method to do so as depicted below.
I want to get available values from query in my ssrs report parameter.
I set Get values from a query
DataSet : name of my dataset#
Value field: my field
Label field : my field
To get an idea i will show you what i mean:
For expected results : I want to use my parameter as multie value parameter..
Your expression should be something like this and you need to add this expression by pressing fx next to value rather than directly adding it.
=IIF(Parameters!RootPoint.Value(0)="",Fields!C_RootPoint.Value,Parameters!RootPoint.Value(0))
also if you are trying to check if your first parameter value is null then you should try like below
=IIF(Isnothing(Parameters!RootPoint.Value(0)),Fields!C_RootPoint.Value,Parameters!RootPoint.Value(0))
I have created a stacked column report in SSRS which is working ok except on few columns when value is null some strange words are displaying.
I don't want to display any value where value is zero
Please help me how to display null in case of zero value.
In the value expression, if the value is null, set it to Nothing.
IIF(Field.Value = 0,Nothing,Field.Value)
'Nothing' is compatible with numeric datatypes , but it will generally show as 'blank' value in a cell.
I'm working on setting up a report in SSRS. Our report is somewhat flexible, and I'm looking to dynamically select an image for a cover page based on a parameter.
Here's what I have:
In our Reports db I have an image table set up. To keep things simple, lets just say I have three columns:
ImageName, ImageType, and Image.
Name and type are both varchar while ImageType is varbinary. I've uploaded the images we plan on using as well as their names and associated types to the table.
In my report I have a Data Source and a Dataset for bringing in the above table and columns.
I also have a parameter called "ImageName." I've set this parameter up to use "Image" (from the table described above) as its value field and the label field is set up for "ImageName."
On the report itself I have an image ... control? Report element? Not sure what to call it, but I've set up an image. The image source is set to "Database" and the MIME type uses the lookup function to pull the appropriate image type from the Dataset based on the Parameters!ImageName.Label argument - and that part works a treat - I'm returning the proper MIME type each time.
What doesn't work, and I would expect should work, is setting the image itself. For the "Use this field" field under "Select the image source:" I've tried both =Parameters!ImageName.Value with no success as well as a lookup based on the ImageName.Label from the images Dataset. Neither seem to work.
When I try using the parameter value, I'm getting the error
[rsInvalidDatabaseImageProperty] The value of the ImageData property
for the image 'ImageControlName' is "=Parameters!ImageName.Value",
which is not a valid ImageData.
I get essentially the same error message from the lookup method, it just swaps the lookup code for the Parameters!ImageName code above.
If I attempt to check the type returned by the lookup above I simply get an error. For the parameter if I check the type I get System.String so I decided to print that out and apparently the value of Parameters!ImageName.Value is System.Byte[] for some reason.
I can get an image to display using the First() function, but I need to be able to select the image. I'm guessing I may have to filter. First() has a return type of System.Byte[], which seems reasonable. I just don't understand why my parameter is returning the type of the image data column as a string rather than the data from the image column itself.
So how do I get this working? Is filtering my Dataset my only option? Or is there a way to get the parameter working or to get some function that will allow me to select the appropriate image?
Reason for your error is because of the data types returned by Parameters vs First.
For the Parameters data type returned is of type text and which is not valid image data type hence the error.
For First function it returns the data type based on type of expression and it returns the right type of data type for image and displays the image.
Per Microsoft Parameter Data Type:
A report parameter must be one of the following data types:
Boolean. The user selects True or False from a radio button.
DateTime. The user selects a date from a calendar control.
Integer. The user types values in a text box.
Float. The user types values in a text box.
Text. The user types values in a text box.
When available values are defined for a parameter, the user chooses
values from a drop-down list, even when the data type is DateTime.
Per Microsoft First function data type:
Return Type
Determined by the type of expression.
You are correct to get the right image you need to filter the dataset.
Create dataset which gives ImageName, ImageType, and Image.
Based on image parameter filter the dataset on ImageName.
Now use the following expression to get the correct image data.
=Fields!Image.Value
I am using SSAS cube to display data in my report. There is a date column in the cube which may be blank. If it is blank I need to display blank otherwise I need to format it as "MM-yyyy". I am using the below mentioned expression in the column.
=IIf(Trim(Fields!Chargeoff.Value) = "", "",
Format(CDate(Fields!Chargeoff.Value), "MM-yyyy"))
The rows which have date values are perfect with the correctly formatted date being displayed. However for blank rows, it displays error saying
The Value expression for the textrun ‘Chargeoff.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "" to type 'Date' is not valid
I tried with IsNothing, Null and everything else that came to my mind but could not get to display blank.
Does anyone have any suggestions on how to do this?
Update
I actually formatted my date in SSAS instead of SSRS.. That did the trick for me..
=IIF(CDATE(IIF(TRIM(Fields!RequiredStart.Value).ToString().Length = 0,
"1/1/0001",
Fields!RequiredStart.Value)).ToString() = CDATE("01/01/0001"),
"",
Format(CDATE(IIF(TRIM(Fields!RequiredStart.Value).ToString().Length = 0,
"1/1/0001",
Fields!RequiredStart.Value)), "dd-MMM-yyyy"))
:)
try putting and Empty Date in for the output instead of an empty string. 00-0000 it is looking for a Date and you give it an empty String. I would imagine that you either have to give it an empty date or a Default Date