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.
franciscoacunac
New Contributor II

Change number Format MySQL field

Hello everybody,

I am just starting the qlikview connection with a MySql DataBase and I've encountered my first problem which is giving me a hard time.

This is my problem:

I have this sequence of numbers:

123456789

but I just need the first 8 numbers.

As a qlikview script I used the following sentence:

If(Len(number)=9,Left(number,8) as Number

but with the MySql script I can't find a similar function.

Can anybody help me?

1 Solution

Accepted Solutions
mov
Esteemed Contributor III

Re: Change number Format MySQL field

It is helpful to use preceding load, so you can use SQL functions in the SQL SELECT part and QV functions in LOAD part:

LOAD

If(Len(number)=9,Left(number,8) as Number

;

SQL SELCT

number

FROM my table;

3 Replies
awhitfield
Esteemed Contributor

Re: Change number Format MySQL field

Looks like it's

LEFT()

Return the leftmost number of characters as specified

https://dev.mysql.com/doc/refman/5.0/en/string-functions.html

Andy

mov
Esteemed Contributor III

Re: Change number Format MySQL field

It is helpful to use preceding load, so you can use SQL functions in the SQL SELECT part and QV functions in LOAD part:

LOAD

If(Len(number)=9,Left(number,8) as Number

;

SQL SELCT

number

FROM my table;

Re: Change number Format MySQL field

Hi,

Qlikview have Left() but you missed closing bracket

If(Len(number)=9,Left(number,8)) as Number

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Community Browser