brunobonna Posted November 13, 2022 Report Share Posted November 13, 2022 Hi All, I made a DataPage to update a table based on external parameters. The problem is that I only want it to update the fields to which parameters were passed. If no parameters are passed for a specific field, I want to leave it as it is. I used "calculated value" for that, but I wasn't able to take any action based on the nonexistence of a parameter. Let's say I have only 2 clients: This works: https://myapp.com?Client1=2&Client2=5 This doesn't work: https://myapp.com?Client1=2 Client2 will be filled as blank. I've tried using conditionals in calculated values like IsNull(), NullIf(), CASE - IsNull([@Client2],[@field:C2]) --- C2 being the original field name - CASE WHEN [@Client2] = NULL THEN [@field:C2] ELSE [@Client2] - CASE WHEN [@Client2] = '' THEN [@field:C2] ELSE [@Client2] I've also tried replacing parameters and field names with virtual fields, trying to avoid any circular errors. So I created: Virtual1 that receives external parameter [@Client2] Virtual2 that receives Data Source Fields C2 Then I tried the same strategies above using these virtual fields: CASE WHEN [@cbParamVirtual1] ="" THEN [@cbParamVirtual2] ELSE [@cbParamVirtual1] END Client 2 keeps receiving blank One thing that worked was to build the URL with all the parameters and just zero them to control behavior: https://myapp.com?Client1=2&Client2=0 When compared to 0, my conditionals will work. But that would make my URL enormous, and I am trying to avoid that. Any ideas will be very welcome. Thanks, Quote Link to comment Share on other sites More sharing options...
0 CoopperBackpack Posted November 14, 2022 Report Share Posted November 14, 2022 Hello @brunobonna, As I understood from your description you need to check whether the Virtual field that receives the External parameter is blank. Please test the following syntax: CASE WHEN '[@cbParamVirtual1]' = '' THEN ... END Or CASE WHEN LEN('[@cbParamVirtual1]') = 0 THEN ... END Replace [@cbParamVirtual1] with the field name on your DataPage is needed. Hope this helps. Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted November 29, 2022 Report Share Posted November 29, 2022 In addition to the previous response, if you are using a parameter or virtual fields in the calculation, enclose them with single quotation marks. I am not sure of the exact reason, but every time I am getting a calculation error, the only issue is that I am missing the quotation marks. Hope this helps! Quote Link to comment Share on other sites More sharing options...
0 Queso Posted December 30, 2022 Report Share Posted December 30, 2022 Hello, you can try adding resetting parameter at the end of the URL and do the testing on the DataPage's deploy URL (Not in Preview) because you are checking parameter values. Quote Link to comment Share on other sites More sharing options...
Question
brunobonna
Hi All,
I made a DataPage to update a table based on external parameters.
The problem is that I only want it to update the fields to which parameters were passed.
If no parameters are passed for a specific field, I want to leave it as it is.
I used "calculated value" for that, but I wasn't able to take any action based on the nonexistence of a parameter.
Let's say I have only 2 clients:
This works: https://myapp.com?Client1=2&Client2=5
This doesn't work: https://myapp.com?Client1=2
Client2 will be filled as blank.
I've tried using conditionals in calculated values like IsNull(), NullIf(), CASE
- IsNull([@Client2],[@field:C2]) --- C2 being the original field name
- CASE WHEN [@Client2] = NULL THEN [@field:C2] ELSE [@Client2]
- CASE WHEN [@Client2] = '' THEN [@field:C2] ELSE [@Client2]
I've also tried replacing parameters and field names with virtual fields, trying to avoid any circular errors.
So I created:
Virtual1 that receives external parameter [@Client2]
Virtual2 that receives Data Source Fields C2
Then I tried the same strategies above using these virtual fields:
CASE
WHEN [@cbParamVirtual1] ="" THEN [@cbParamVirtual2]
ELSE [@cbParamVirtual1]
END
Client 2 keeps receiving blank
One thing that worked was to build the URL with all the parameters and just zero them to control behavior:
https://myapp.com?Client1=2&Client2=0
When compared to 0, my conditionals will work. But that would make my URL enormous, and I am trying to avoid that.
Any ideas will be very welcome.
Thanks,
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.