| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

03-03-04, 11:44
|
|
Registered User
|
|
Join Date: Jan 2004
Location: amsterdam
Posts: 31
|
|
|
OPAL in a report
|
|
I'd like to do calculations in a report, based on the value of a variable. This has to yield a new field in the report with text. A calculated field cannot contain more than one statement (?), thus I cannot use the iif statement (only two values). For instance, if my variable has the value <10, the new variable should contain "low", between 10-20 "middle" and >20 "high", to be printed on the report.
This can easily be done in OPAL, but how to use this in a report? I can't attach code to a variable.
|
|

03-03-04, 12:15
|
|
Registered User
|
|
Join Date: Oct 2003
Posts: 107
|
|
I don't know any way to do that off the top of my head. You may need to add an extra field for this notation and apply the correct label during a scan loop right before the report is displayed.
|
|

03-04-04, 21:07
|
|
Registered User
|
|
Join Date: Feb 2004
Location: Gold Coast, Queensland, Australia
Posts: 15
|
|
|
Re: OPAL in a report
|
|
Originally posted by fepsy
I'd like to do calculations in a report, based on the value of a variable. This has to yield a new field in the report with text. A calculated field cannot contain more than one statement (?), thus I cannot use the iif statement (only two values). For instance, if my variable has the value <10, the new variable should contain "low", between 10-20 "middle" and >20 "high", to be printed on the report.
This can easily be done in OPAL, but how to use this in a report? I can't attach code to a variable.
Hi,
Did you know that you can nest iif's?
e.g. iif(my_variable<10,"low",iif(my_variable>20,"high" ,"middle"))
This will achieve the above in one statement that is in your field calculation.
The variable my_variable could be stored in a table in your private directory and referenced directly by the field calculation
e.g. iif([:priv:Temptbl.my_variable]<10,"low",iif([:priv:Temptbl.my_variable]>20,"high","middle"))
Let me know how you go.
Cheers.
__________________
YuriK
|
Last edited by Yuri Korin; 03-06-04 at 10:35.
|

03-04-04, 21:47
|
|
Registered User
|
|
Join Date: Feb 2004
Location: Gold Coast, Queensland, Australia
Posts: 15
|
|
Re: OPAL in a report
Originally posted by Yuri Korin
Originally posted by fepsy
I'd like to do calculations in a report, based on the value of a variable. This has to yield a new field in the report with text. A calculated field .
.
.
.
e.g. iif([:priv:Temptbl.my_variable]<10,"low",iif([:priv:Temptbl.my_variable]>20,"high","middle"))
Let me know how you go.
Cheers.
Sorry, I'm not sure how those icons got into the body of the second example but here it is, cleared of icons.
iif([:priv:Temptbl.my_variable]<10,"low",iif([:priv:Temptbl.my_variable]>20,"high","middle"))
__________________
YuriK
|
Last edited by Yuri Korin; 03-08-04 at 03:25.
|

03-04-04, 21:58
|
|
Registered User
|
|
Join Date: Feb 2004
Location: Gold Coast, Queensland, Australia
Posts: 15
|
|
|
Re: OPAL in a report
This is driving me nuts. Please replace the icon with ":P"
Cheers,
__________________
YuriK
|
|

03-05-04, 09:55
|
|
Registered User
|
|
Join Date: Oct 2003
Posts: 107
|
|
Yuri, edit your post and disable the smilies (checkbox at bottom). Also, thanks for the info on nesting the iifs!
|
|

03-08-04, 03:44
|
|
Registered User
|
|
Join Date: Feb 2004
Location: Gold Coast, Queensland, Australia
Posts: 15
|
|
Originally posted by lmckelvy
Yuri, edit your post and disable the smilies (checkbox at bottom). Also, thanks for the info on nesting the iifs!
Thanks for that. I didn't know that you could do either of those.
Cheers,
__________________
YuriK
|
|

03-08-04, 04:19
|
|
Registered User
|
|
Join Date: Jan 2004
Location: amsterdam
Posts: 31
|
|
This is great, thanks! Never thought of this solution, I'll check if this works in PDOX4.5 too, it always annoyed me.
I didn't see any smileys.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|