Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

ceil() help

Hello all

Im new in QV

i have 2 fields like this.


load * inline [
type, weight
normal, 0.2
express, 0.8
saver, 2.4
express, 1.1
normal, 0.7
....
];


is it possible to use ceil() each types?

Labels (1)
7 Replies
pljsoftware
Creator III
Creator III

Hi Muncho,

I hope is this what do you want.

OriginalTable:

load * inline [

type, weight

normal, 0.2

express, 0.8

saver, 2.4

express, 1.1

normal, 0.7

//....

];

NewTable:

load

type as Type

,ceil(weight) as Weight

resident OriginalTable;

drop table OriginalTable;



Not applicable
Author

Hi Muncho,

Yes, it is possible to use ceil().

Take resident of our inline table

new_table:

load

type,

ceil(weight) as weight

resident inline_table;

Drop table inline_table;

Hope you get it.

Regards,

Yogesh


Not applicable
Author

No, no you guys get it wrong.

I need ceil it different for each types.
like normal weights ceil(weight), and express(weigh, 0.5) etc.

Not applicable
Author

Hi Mucho,

if you have 3 or 4 attributes in type field, try to use

if condition as

if(type='normal', ceil(weight),

if(type='express', ceil(weight, 0.5),

........

))) as new_weight,

hope this help you.

Thanks & Regards,

Yogesh

Not applicable
Author

Hi Yogesh.

Can i ask you 1 more thing again?
how about this one

express, 0.5
express, 1
express, 1.5
......
express, 10
express, 11
express,12
so on.
i need to ceil 0.5 in under 10 and ceil 1 in after 10.

Not applicable
Author

I wanna end it today. Please someone help me : [

pljsoftware
Creator III
Creator III

Hi,

use the clause WHERE weight<=10 when you create your new table and make other WHERE for weight>10.