I have the query questions “1, Year 1 :” and “2, Year 2 :” I want to use to address the years I want the data for from Measures v_NumberBlocks.
The variabel editor is: =([v_NumberofBlocks] Where ([Year]=(UserResponse(“1, Year 1 :”)))/[v_NumberofBlocks] Where ([Jaar]=(UserResponse(“2, Year 2 :”)))*100)
I get the error
The expression or sub-expression at position 35 in the ‘=’ function uses an invalid data type.
I am interrested to know whether that are number, char or date fields.
Because UserResponse fuction take userinput as char format.
If Your objects are number then You need to convert input value to number. By using ToNumber() function.
Thanks for your quick response, but I have a user query Prompt asking for year 1 and Jaar 2. I want the User Responses to these queries to be filtered for the years in the BO document.
And I do not understand how to apply the ToNumber() function in my code:
=([v_NumberofBlocks] Where ([Year]=(UserResponse(“1, Year 1 :”)))/[v_NumberofBlocks] Where ([Jaar]=(UserResponse(“2, Year 2 :”)))*100)
=([v_NumberofBlocks] Where ([Year]=(tonumber(UserResponse("1, Year 1 :")))/[v_NumberofBlocks] Where ([Jaar]=(tonumber(UserResponse("2, Year 2 :"))))*100)
[Moderator Edit: Added code formatting - Jansi] When posting code samples please use the code option for formatting. It will preserve any indenting or formatting that you may have done.
=[v_NumberofBlocks]Where([Year] =(ToNumber(UserResponse(“1, Year 1 :”))))/[v_NumberofBlocks]Where([Year] =(ToNumber(UserResponse(“2, Year 2 :”))))*100
This is the code I used, and it is pretty much the same as you suggested, right? So yes, it works.
I had to convert some of the names of objects and translate things for this forum because of disclosure issues. But your syntax works, thank you for your time and help!