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: 
julruiz123
Partner - Creator
Partner - Creator

Load number as string

Hi,

I have the next situation, in a database is stored the time as follow

9.01

6.45

7.10

8.10

So i need replace point by colon, but the string change as follows

7:1

8:1

How i can prevent the zero runs out?

Thanks.

1 Solution

Accepted Solutions
julruiz123
Partner - Creator
Partner - Creator
Author

Hi,

This is the solution

Time(Time#(Num(trahoi,'00.00'),'hh.mm'),'hh:mm TT') as trahoi1

Thanks for the help!

View solution in original post

11 Replies
its_anandrjs

Hi,

Use Replace command like

Len(Replace( YourTimeField, ' . ', ' : ' ) ) = 3

Rgds

Anand

swuehl
MVP
MVP

I would suggest parsing your time in as Time format, like

LOAD

..

Time(Time#(YOURTIMEFIELDSTRING,'hh.mm'),'hh:mm') as TimeField,

...

FROM ...;

Hope this helps,

Stefan

edit: corrected time format output

julruiz123
Partner - Creator
Partner - Creator
Author

Hi,

It doesn't work the two alternatives.

The strange thing is tha i try with

Text(TimeField) but the result is the same

7:1

8:1

swuehl
MVP
MVP

Does the string change only after you applied Replace() function or if you just read it in from data base?

Could you check if you get a string or a numerical returned?

If you use something like

..

num(TimeField,'00.00') as TimeField

..

You should get two decimal places. if you the use my above suggestion, you should get what you want. But maybe I just don't get what's going on. Could you post a small sample?

Regards,

Stefan

Not applicable

Might not be the correct way, but in the object that you have this field in go to the Number tab, set it Fixed to 2 decimals, and then change the Decimal separator to :

ToniKautto
Employee
Employee

Please provide a sample of your script when you get the unexpected value, so that we can make a better judgement of what you need to do.

julruiz123
Partner - Creator
Partner - Creator
Author

Hi,

This is the example.

When i try to modify the field trahoi the zero runs out.

Thanks

ToniKautto
Employee
Employee

Please try unfromatting your loaded fields.

1. Settings > Document Properties > Number

2. Select the field of your choice, in this case trahoi

3. Klick the Default from Input button and you will see that the format now changed to the value stored in the QVD, which is a two decimal numeric value

4. I you want QlikView to always load the source format, you should also uncheck the Survive Reload checkbox

Please notice that you can override the document's setting on a object level, in the object properties' number tab. In case your document settings look ok while your object presents the value incorrectly you should check the object level settings.

---

Using QV10 SR3 there is no problem with setting the replacement already in the load script. Are you using an other version?

LOAD

Replace(col, '.', ':') as colon

Inline [

col

9.01

6.45

7.10

8.10

];

SunilChauhan
Champion
Champion

see the attached file

hope this help.

if any thing else then let me know

Sunil Chauhan