• 0
Login to follow this  
ray985

Using external parameters in calculated field

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

 

Share this post


Link to post
Share on other sites

2 answers to this question

  • 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

Share this post


Link to post
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

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Login to follow this