Jump to content
  • 0

How to deal with missing parameters in URL


brunobonna

Question

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

  • 0

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. 

Link to comment
Share on other sites

  • 0

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!

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...