Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
i got Question, i am using the Function: Wildmatch() to build some flags, for instance:
table:
ID, TYP
1, 100
2, 100
3, 200
4, 210
in script area i created this Expression to build the flags:
if(wildmatch(TYP, '*100*','*110*'),'DB1',
if(wildmatch(TYP, '*100*','*110*','*200*','*210*'),'DB2', 'Rest')) as Flag.
After script-reloading i have the following data:
DB1 has only 100, 110
DB2 has only 200, 210 (although the DB2 should consists of 100, 110, 200, 210 , but the values 100, 110 will be not considered ).
Does anybody have any idea how to solve / create the flags with the function: Wildmatch(), any another suggestions are appreciated.
Thanks a lot
Beck
But you can not assign DB1 or DB2 individually on same data column 🙂
Ok I give you another approach.
if(wildmatch(TYP, '*100*','*110*'),'DB1,DB2',
if(wildmatch(TYP,'*200*','*210*'),'DB2', 'Rest')) as Flag.
Sum({<FLag = {"*DB1*"}>}Sales) = 7
Sum({<FLag = {"*DB2*"}>}Sales) = 16
how about this?
Hi Beck,
if(wildmatch(TYP, '*100*','*110*'),'DB1',
if(wildmatch(TYP, '*100*','*110*','*200*','*210*'),'DB2', 'Rest')) as Flag.
DB1 has only 100,110 and DB2 has only 200,210.
The result seems right for this expression because if TYP is *100* or *110*, it generates true for the first if block. So records marked as 'DB1' and exit the if statement. If TYP is not *100* or *110*, it generates false and go to second if block. So that means there is no chance *100* or *110* records marks as 'DB2'
What is your goal after all? If you can explain it clearly, you will get useful suggestions I think 🙂
Hi Kaanerisen,
thanks a lot for your responce. my expected Output is, to build the flags
DB1 with Values (100,110)
DB2 with Values (100,110, 200, 210), as you see the DB2 has the values: 100, 110 as well. (i could solve this issue by using of this Expression (DB1= 100, 100) + DB2=(210, 200) so that way i could have the Expression: DB2 with values: 100, 110, 200,210).
i would like to know, is that possible to create These flags by another way?
thanks a lot
Sorry Beck ,I am pretty lost 🙂
- What is DB1 or DB2?
- Let's think about a record which TYP value is 110. what makes it DB1 or DB2. I mean what is the decision point?
Hi Kaanerisen,
DB1 and DB2 are my flages that i want to use for creation of further Expression.
TYP, Sales
100, 5
110, 2
200, 4
210, 5
so i create the flags: DB1 = 100, 110 and DB2 = 100, 110, 200, 210 then i can create These expressions:
Sum({<FLag = {"DB1"}>}Sales) = 7
Sum({<FLag = {"DB2"}>}Sales) = 16
that is my reason, why i want to create These flags
i hope explained well
But you can not assign DB1 or DB2 individually on same data column 🙂
Ok I give you another approach.
if(wildmatch(TYP, '*100*','*110*'),'DB1,DB2',
if(wildmatch(TYP,'*200*','*210*'),'DB2', 'Rest')) as Flag.
Sum({<FLag = {"*DB1*"}>}Sales) = 7
Sum({<FLag = {"*DB2*"}>}Sales) = 16
how about this?
Hi Kaanerisen,
thanks a lot for time, Patience and your Time, it does look great and it does work great 😃
I am glad to hear that 😊