Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How can I use If condition in the script when I have the situation below?
I need to show the Qty fild only if I have the 'Y' in the Trans field .
The problem is the Trans field is from the Order table and the Qty fild is from the OrderDetail table.
Order:
LOAD
Pedido as Order,
DtPedido as OrderDate,
CGC as Customer,
Represen as Rep,
Trans
FROM
OrderDetail:
LOAD
Pedido as Order,
Modelo as Produc
Qty
// if (Trans = 'Y', Qty) as Order_Qty
FROM
Best Regards,
Rodrigo
There are more than one solution; I like solutions: a)-easy to understand, b)-fast in reload.
This is my suggestion:
Order:
LOAD
Pedido as Order,
DtPedido as OrderDate,
CGC as Customer,
Represen as Rep,
Trans
,if (Trans = 'Y', Pedido) as TransOrder // add a new field with "Trans" Orders only
FROM
OrderDetail:
LOAD
Pedido as Order,
Modelo as Produc
,if(exists(TransOrder,Pedido),Qty) as Order_Qty // fill the Qty for "Trans" Orders
FROM
You like ?
Roberto
There are more than one solution; I like solutions: a)-easy to understand, b)-fast in reload.
This is my suggestion:
Order:
LOAD
Pedido as Order,
DtPedido as OrderDate,
CGC as Customer,
Represen as Rep,
Trans
,if (Trans = 'Y', Pedido) as TransOrder // add a new field with "Trans" Orders only
FROM
OrderDetail:
LOAD
Pedido as Order,
Modelo as Produc
,if(exists(TransOrder,Pedido),Qty) as Order_Qty // fill the Qty for "Trans" Orders
FROM
You like ?
Roberto
Thanks for you reply Roberto. I liked very much!