Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scripting help please

hello everyone,

i have a littele difficulty in writing a script.

i have a long list of channel Ids and i i know which channel ID sold our product. Now for the purpose of overview i want to calculate a column which only show which different chanels were used before that sale was made.

i am using this left function

left('CIDconsecution.channel',Visitor.consecution) as List

but its always giving me invalid expression error. As the second parameter should be number. Is there anyother way to do this or any script help?

Regards,

Salman

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

SubField() will do it if I understand you correctly.  Or a mixture of LEFT() and Index.

SubField(pfad,'Visitor.consecution',1)

Hope this helps,

Jason

View solution in original post

6 Replies
Michiel_QV_Fan
Specialist
Specialist

Set the Visitor.consecution as a variable

untested but something like this:

set vVisitor.consecution = 3;

left('CIDconsecution.channel',$(vVisitor.consecution)) as List

Miguel_Angel_Baeyens

Hi Salman,

Which form has a sample line you want to modify? Left() function returns the n first (starting from left) characters of a given string or field, hence the second parameter needs to be a number or an expressionor variable that returns a numeric value. Is that what you need?

Hope that helps.

Miguel

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Can you post some sample data, or better still your app?

Jason_Michaelides
Luminary Alumni
Luminary Alumni

SubField() will do it if I understand you correctly.  Or a mixture of LEFT() and Index.

SubField(pfad,'Visitor.consecution',1)

Hope this helps,

Jason

Not applicable
Author

thanks everyone for the help.

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Giving yourself credit for the answer doesn't help other visitors to this thread knowing which solution worked for you!