Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
normally one record is one record.
However, new development brings up the question how I can load a record twice,
say key: Record1 and Record1a where I have to calculate the turnover twice but the profit once, split into
Record1 for 50% and Record1a also for 50%.
I would LOAD the Record1 and double it, naming the double Record1a.
Any idea on the optimal loading and script technique?
Thank you so much, happy to work together in this community.
Wolfgang
Maybe this could be an alternative:
LOAD Key & If(Iterno() = 2,'a','') as Key,
Profit / 2 as Profit,
Turnover
FROM ....
WHILE iterno() <=2;
May be something like this:
Table:
LOAD FieldName
FROM Source;
Concatenate (Table)
LOAD FieldName & 'a' as FieldName
FROM Source;
Maybe this could be an alternative:
LOAD Key & If(Iterno() = 2,'a','') as Key,
Profit / 2 as Profit,
Turnover
FROM ....
WHILE iterno() <=2;
Maybe by using a WHILE clause? The following doubles all rows:
:
SplitProfitTable:
NOCONCATENATE
LOAD RecordID & pick(IterNo(), '', 'a') AS RecordID,
Revenue,
Profit * 0.5 AS Profit
RESIDENT OriginalTable
WHILE IterNo() <= 2;
So do this:
Temp:
load
RecordNo,
Turnover
from Source;
left join load
RecordNo,
count(RecordNo) as Counter
resident Temp;
left join (Temp) load
RecordNo,
Profit
from Source;
Final:
load
RecordNo,
Turnover,
Profit/Counter as Profit
resident Temp;
drop table Temp;
Regards
Danke.
Damit komme ich weiter. Peter hat auch diesen Weg beschrieben.
Wolfgang