Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am new to Qlikview. I have a list or order numbers. The orders that end in an 81 are those that belong to a specific product type (type a)
45615
123
7894
581
44781
75984
4581
I would like to use an IF function to return those order numbers that end in 81 to be highlighted as 'type a' and the others as 'type b'.
Can you help please?
Thanks
This can be done in the load script. For example:
Orders:
Load * Inline [
Order, Product
1,101
2,102
3,181
4,282
];
OrdersWithFlag:
Load
*,
If (Right (Product,2)='81','Type A','Type B') as IsTypeAProduct
Resident Orders;
Drop Table Orders;
Table OrdersWithFlag will contain both the original product an indicator for product type (which here I've called IsTypeAProduct).
Loading the flag in the script may be the easiest in that it creates a flag that you can reference all throughout your document without having to rewrite the formula each time.
You can also add the above formula, for example, as an expression in a straight table chart (sans 'as IsTypeAProduct'), and it'll work. This may be the better solution if you don't want to mess with the script or only need the indicator in one or two place. The straight table will look like this:
Hi,
Try like
If (right (yourfield,2)=81,'Type A','Type B') as [Product Type]
Hi,
Another option could be using match() and wildmatch()
like
if(wildmatch(fieldName,'*81'),'Type A','Type B') as Product_Type
Regards
create a field in script like
if(FieldName like '*81','Type a','Type b') as Product _Type