Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Mattia
Creator II
Creator II

What's wrong in this script?

Hi Everyone,

the following expression give me only 1 result "AMB", while don't show me "LAB".

If([@4:9]=001880,'DIALISI', If(WildMatch([@10:17],'L*'),'LAB',  If(Len(Trim([@10:17]>0)), If([@4:9]=030357,'PS_AMB','AMB')))) as TIPO

Please, someone can help me?

Thanks,

Mattia

Labels (2)
2 Solutions

Accepted Solutions
sunny_talwar

May be try this

If([@4:9] = '001880', 'DIALISI',
	If(WildMatch([@10:17], 'L*'), 'LAB',
		If(Len(Trim([@10:17]))>0,
			If([@4:9] = '030357', 'PS_AMB', 'AMB')))) as TIPO

View solution in original post

sunny_talwar

Not sure why it doesn't work for you... but it seems to work for me... Sample script

Table:
LOAD *,
	 If(Field1 = '001880', 'DIALISI',
		If(WildMatch(Field2, 'L*'), 'LAB',
			If(Len(Trim(Field2))>0,
				If(Field1 = '030357', 'PS_AMB', 'AMB')))) as TIPO;
LOAD * INLINE [
    Field1, Field2
    001880, HSKJS
    193829, LHDSH
    001880, LDFHS
    030357, EHFSH
    030357, LDHFS
    030357,
];

Here Field1 = [@4:9] and Field2 = [@10:17]

and this is what I get

image.png

View solution in original post

6 Replies
sunny_talwar

May be try this

If([@4:9] = '001880', 'DIALISI',
	If(WildMatch([@10:17], 'L*'), 'LAB',
		If(Len(Trim([@10:17]))>0,
			If([@4:9] = '030357', 'PS_AMB', 'AMB')))) as TIPO
Mattia
Creator II
Creator II
Author

Hi Sunny,

unfortunately, the script don't run anyway.

Do you have another suggest?

Thank you so much,

Mattia

 

sunny_talwar

What error message do you get when you run this?

Mattia
Creator II
Creator II
Author

Excuse me Sunny, i misspoke.

The script runs but the value of the field "TIPO" is only "AMB", altough i've values in the table that match the expression: If(WildMatch([@10:17],'L*'),'LAB'

If can help you, if i hidd the last expression If(Len(Trim([@10:17]))>0, If([@4:9] = '030357', 'PS_AMB' , 'AMB', the value of the field "TIPO" is LAB.

sunny_talwar

Not sure why it doesn't work for you... but it seems to work for me... Sample script

Table:
LOAD *,
	 If(Field1 = '001880', 'DIALISI',
		If(WildMatch(Field2, 'L*'), 'LAB',
			If(Len(Trim(Field2))>0,
				If(Field1 = '030357', 'PS_AMB', 'AMB')))) as TIPO;
LOAD * INLINE [
    Field1, Field2
    001880, HSKJS
    193829, LHDSH
    001880, LDFHS
    030357, EHFSH
    030357, LDHFS
    030357,
];

Here Field1 = [@4:9] and Field2 = [@10:17]

and this is what I get

image.png

Mattia
Creator II
Creator II
Author

Sorry, Sunny.

It works perfectly.

Mattia