Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
mattphillip
Creator II
Creator II

Adding a character inside field value in load script

Hoping someone can help. I've got a session field with values formatted as yyyy/y (e.g. 2016/7, 2017/8). However, I'm trying to find a way to amend the field values by adding a 1 at character position 6 to present the values as 2016/17, 2017/18 etc. Does anyone have any idea whether this is possible? I've seen examples where a character has been added to the beginning or the end but never inside the string itself.

Any help would be most appreciated.

Yours,

Matt

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Or this?

SubField(YourField, '/',1) & '/1' &SubField(YourField, '/', -1)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

8 Replies
jmvilaplanap
Specialist
Specialist

Hi Matt

try with yyyy/1y

Regards

mattphillip
Creator II
Creator II
Author

Hi Jose,

Thank you. Could you illustrate how to do this within the load script?

Many thanks.

Matt

tresesco
MVP
MVP

One way could be like:

Load

          Replace(YourField, '/','/1') as NewField

jmvilaplanap
Specialist
Specialist

Is the same, if the value is a date, then

date(DateField, 'yyyy/1y')     As newField

But sincerly I don't understand why you need this format, you are writing the year '/' the number one and the last digit of the year. Are you sure do you want this?

Regards

Anil_Babu_Samineni

Or this?

SubField(YourField, '/',1) & '/1' &SubField(YourField, '/', -1)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
mattphillip
Creator II
Creator II
Author

Yes I have to so it matches legacy data.

mattphillip
Creator II
Creator II
Author

Brilliant thanks Anil!

Anil_Babu_Samineni

Even, I don't prefer this? Because, What if you have data 2016/11, 2017/12 ???

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful