Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
Showing results for 
Search instead for 
Did you mean: 

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!

1 Reply
MVP & Luminary
MVP & Luminary

Re: String values

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