Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
pauledrich
Contributor

Creating a Number in script

Hi & thanks for any help on this one.

I have the need to create a 10 digit number based on two fields - one field is always static at 4 digits and the other is a transaction ID.

So I would like to create one in the script known as 'ItemCode' the format would look something like:-

<4 digits><Padding><TransID>

Regards

P

8 Replies
bbi_mba_76
Valued Contributor

Re: Creating a Number in script

Hi,

maybe with

<4 digits>&right('000000'&<TransID>,6)

Not applicable

Re: Creating a Number in script

Hi Paul,

You may try Column1 & Column2 , this should append both of your values.

Thanks,

Sai

pauledrich
Contributor

Re: Creating a Number in script

Hi Thanks - Still learning the craft.... where would this be placed in the script as I get a syntax error...

I am using

Load

Field1 & Right ('000000' & Field2,6) as ItemCode

pauledrich
Contributor

Re: Creating a Number in script

Thanks - I had thought of that, I want the string to be no longer and no less than 10, so 1234000012.

1234 = (Field1 Value)

0000 = (Padding - which will need to reduce as trans number increases)

12 = (Field3 Value)

P

Not applicable

Re: Creating a Number in script

Hi Paul,

Can you try this:

ID &0000& Left(Value,2)

Thanks,

Sai

angelaecheverri
Contributor

Re: Creating a Number in script

Try Text(Field1&Right(('000000'&Field2),6))

if you want to use  '-' between will be something as:

Text(Field1&'-'&Right(('000000'&Field2),6))

Not applicable

Re: Creating a Number in script

Paul,

Try creating an expression with the above value and display it in the required chart or may be a variable.

Thanks,

Sai

bbi_mba_76
Valued Contributor

Re: Re: Creating a Number in script

In the attachment you could find an example.

Community Browser