Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Bravo_B
Contributor
Contributor

Formula help please!

Hi Brains Trust,

I wonder if you can please help me with my formula. The formula in a field I have created is to find the letter D in one of the other columns in the set. In the new field put the word 'Dog' and for all other letters/numbers that appear, put an 'X'.

If (WildMatch([Animals]'D*')=1, 'Dog' [,else 'X']) 

Please see the table below;

D = Dog, C = Cow, H = Horse, F = Fish, B = Bird

ColourAnimalResults (Formula above)
BrownD, C, H 
GreenF, B 
BlackD, C, H, F, B 

 

I have tried this formula but is still saying there is an error, can anyone shed some light on where I'm going wrong or what I could try?

Thanks in Advance!

6 Replies
MayilVahanan

HI @Bravo_B 

Try like below

MapName:
Mapping LOAD * Inline
[
A1, A2
D, Dog
C, Cow
H, Horse
F, Fish
B, Bird
];

Temp:
LOAD *, Trim(SubField(Animal,',')) as A1 INLINE [
Colour, Animal
Brown, "D, C, H"
Green, "F, B"
Black, "D, C, H, F, B"
];

Load Colour, Concat(ApplyMap('MapName', A1, 'X'),',') as Animal Resident Temp group by Colour;

DROP Table Temp;

Thanks & Regards,
Mayil Vahanan R
rvc_121985
Contributor III
Contributor III

HI,

Do you have only 5 Vales or animals ?

D = Dog, C = Cow, H = Horse, F = Fish, B = Bird

or is there something apart from this ?

 

Bravo_B
Contributor
Contributor
Author

Hi there,

Yes, only 5 animals. It is part of something bigger, but I am just trying to work out the formula for this kind of scenario.

Thanks!

rvc_121985
Contributor III
Contributor III

Hi ,

Could you please provide the result what you are expecting in other column.

Not sure i, completely understood the problem.

Thanks

Ksrinivasan
Specialist
Specialist

hi,

your formula will be like this

If (WildMatch([Animals],'D*'), 'Dog' ,'XX');

 

ksrinivasan

Ksrinivasan
Specialist
Specialist

hi,

If (WildMatch([Animal],'D*'), 'Dog' ,'XX');