Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
qlik_user2
Contributor
Contributor

String values

Hi there,

In our company we have customers that have a different type of delivery package depending on which weekday it is. those values are in one field that contains a seven-character long string (e.g. 0324256 or 3276458, etc.). The weekdays are in another field next to it and the numbers in the string refer to a certain delivery package.

So now i need a formula to type in the script which gives me a new field with only ONE character that corresponds to the current weekday, so that i can see very easily what sort of package my customer has on a specific weekday.

So for those strings, those are the wanted outputs:

if weekday = tuesday then it gives me the 2nd character of the string

0324256 --> 3

3276458 --> 2

or if weekday = thursday then it gives me the 4th character of the string

0324256 --> 4

3276458 --> 6

Is there such a formula? I know how to do it in Excel but it would be great if i could directly script it in the editor.

Thanks a lot!

Labels (2)
1 Reply
Gysbert_Wassenaar

Mid( SevenCharFieldHere, WeekDayNumberHere, 1) as Result

If you don't have a field with the weekday number, but need to calculate it from today's date you can use WeekDay(Today())


talk is cheap, supply exceeds demand