Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
mattphillip
Contributor

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
Highlighted

Re: Adding a character inside field value in load script

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
Highlighted
jmvilaplanap
Valued Contributor

Re: Adding a character inside field value in load script

Hi Matt

try with yyyy/1y

Regards

Highlighted
mattphillip
Contributor

Re: Adding a character inside field value in load script

Hi Jose,

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

Many thanks.

Matt

Highlighted
MVP
MVP

Re: Adding a character inside field value in load script

One way could be like:

Load

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

Highlighted
jmvilaplanap
Valued Contributor

Re: Adding a character inside field value in load script

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

Highlighted

Re: Adding a character inside field value in load script

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

Highlighted
mattphillip
Contributor

Re: Adding a character inside field value in load script

Yes I have to so it matches legacy data.

Highlighted
mattphillip
Contributor

Re: Adding a character inside field value in load script

Brilliant thanks Anil!

Highlighted

Re: Adding a character inside field value in load script

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)