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.

 
Go Back  dBforums > PC based Database Applications > Corel Paradox > OPAL in a report

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-03-04, 11:44
fepsy fepsy is offline
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.
Reply With Quote
  #2 (permalink)  
Old 03-03-04, 12:15
lmckelvy lmckelvy is offline
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.
Reply With Quote
  #3 (permalink)  
Old 03-04-04, 21:07
Yuri Korin Yuri Korin is offline
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.
Reply With Quote
  #4 (permalink)  
Old 03-04-04, 21:47
Yuri Korin Yuri Korin is offline
Registered User
 
Join Date: Feb 2004
Location: Gold Coast, Queensland, Australia
Posts: 15
Talking 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.
Reply With Quote
  #5 (permalink)  
Old 03-04-04, 21:58
Yuri Korin Yuri Korin is offline
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
Reply With Quote
  #6 (permalink)  
Old 03-05-04, 09:55
lmckelvy lmckelvy is offline
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!
Reply With Quote
  #7 (permalink)  
Old 03-08-04, 03:44
Yuri Korin Yuri Korin is offline
Registered User
 
Join Date: Feb 2004
Location: Gold Coast, Queensland, Australia
Posts: 15
Wink

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
Reply With Quote
  #8 (permalink)  
Old 03-08-04, 04:19
fepsy fepsy is offline
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On