Jump to content
  • 0

Using external parameters in calculated field


ray985

Question

I have a report that has a calculated field in it that is based on a conditional statement. For one of the options, I would like it to multiply a field by the value of an input box. I can't figure out how to do it though. I've tried passing the value as an external parameter in the URL but I can't figure out how to reference that in the calculated field formula. Right now the input field is on the web page that the Caspio iframe is embedded on, but I can also move the input to the header of the form if that would help.  

Is there a way to do this? I'm using the code below...

CASE

WHEN [@field:Per]='lamp' THEN [@field:Per] * 2
WHEN [@field:Per]='fixture' THEN [@field:Cost] * EXTERNALPARAMETER
ELSE 0

END

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
15 hours ago, ray985 said:

I have a report that has a calculated field in it that is based on a conditional statement. For one of the options, I would like it to multiply a field by the value of an input box. I can't figure out how to do it though. I've tried passing the value as an external parameter in the URL but I can't figure out how to reference that in the calculated field formula. Right now the input field is on the web page that the Caspio iframe is embedded on, but I can also move the input to the header of the form if that would help.  

Is there a way to do this? I'm using the code below...


CASE

WHEN [@field:Per]='lamp' THEN [@field:Per] * 2
WHEN [@field:Per]='fixture' THEN [@field:Cost] * EXTERNALPARAMETER
ELSE 0

END

 

I would recommend wrapping parameter name in single quotes, e.g.: '[@param_name]'

This way you will be able to use parameter in sql query. In case of passing parameters to iframe,  you need to use special syntax, try using this solution

Hope that helps

Link to comment
Share on other sites

  • 0
On 4/6/2017 at 9:55 AM, Mathilda said:

I would recommend wrapping parameter name in single quotes, e.g.: '[@param_name]'

This way you will be able to use parameter in sql query. In case of passing parameters to iframe,  you need to use special syntax, try using this solution

Hope that helps

Thanks. That did the trick.

For anyone else that has the same problem, here's the code I ended up using in the calculated field box. I passed the parameter "wattsaved" in the URL to Caspio which came from a textbox in my form. 

CASE
 WHEN [@field:Per]='watt saved' THEN ([@field:Rebate] * '[@wattsaved]')
 WHEN [@field:Per]='kW saved' THEN ([@field:Rebate] * ('[@wattsaved]' / 1000))
  ELSE 0
END

 

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...