Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
mattphillip
Creator
Creator

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)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

8 Replies
jmvilaplanap
Specialist
Specialist

Hi Matt

try with yyyy/1y

Regards

mattphillip
Creator
Creator
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)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

mattphillip
Creator
Creator
Author

Yes I have to so it matches legacy data.

mattphillip
Creator
Creator
Author

Brilliant thanks Anil!

Anil_Babu_Samineni

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)