| Author |
Message |
gmac
Newbie
Joined: 21 Jul 2014
Online Status: Offline
Posts: 3
|

Topic: Build IN clause Posted: 22 Jul 2014 at 8:10pm |
|
hello,
I have a formula that I can not write well. Please help me to solve the task.
There is a running total evaluate: {report.mak} in [array]
The [array] I would like to build in a formula (depending on a parameter): Select {?Pmak} Case "fruit": "apple", "pear", "peach" Case "drink": "cola", "water", "wine"
How do you write the formula to make it work the IN clause?
The goal of this (if {?Pmak} = "fruit") {report.mak} in ["apple", "pear", "peach"]
I tried these versions, but none of them worked: Case "fruit": "apple" + "," + "pear" + "," + "peach" (I got an incorrect results) Case "fruit": array ["apple", "pear", "peach"] (I got an error message)
Thanks gmac
ps: Sorry for my English
|
IP Logged |
|
|
|
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
|

Posted: 23 Jul 2014 at 12:45am |
|
So if I understand correct:
When your parameter says "fruit", you want the text "apple, pear, peach", and when it says "drink" it should say "cola, water, wine"?
if {?Pmak} = 'fruit' then 'apple, pear, peach' else
if {?Pmak} = 'drink' then 'cola, water, wine'
|
IP Logged |
|
gmac
Newbie
Joined: 21 Jul 2014
Online Status: Offline
Posts: 3
|

Posted: 23 Jul 2014 at 2:09am |
|
Not really. Your formula result is a string. If I use this formula in a running total, I not come really result. Because the IN clause work with array, not a string.
My goal is the correct running total: {report.mak} in {@formula}
But I can't write the correct formula.
Thanks!
|
IP Logged |
|
kostya1122
Senior Member
Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
|

Posted: 23 Jul 2014 at 6:43am |
|
this might work
({?Pmak} = 'fruit' and {report.mak} in ['apple', 'pear', 'peach'] or ({?Pmak} = 'drink' and {report.mak} in ['cola', 'water', 'wine'])
|
IP Logged |
|
gmac
Newbie
Joined: 21 Jul 2014
Online Status: Offline
Posts: 3
|

Posted: 23 Jul 2014 at 8:35pm |
|
Kostya1122, when I write your code in the running total evaluate, the result is good. But you don't use formula, you write every condition in the running total. It's not good for me, because I have more running total and I want to display the array in the report.
I want a formula in which the array is created, and I want use this formula in the running total evaluate.
Thanks
Edited by gmac - 23 Jul 2014 at 8:36pm
|
IP Logged |
|
|
|