Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, need help on create new field in script below output required where ever data = 'AB' that recognize Cycle1 after that need to increment Cycle'N'(Cycle1,Cycle2,Cycle3)
ID | Data | Output |
111 | a | Cycle1 |
111 | b | Cycle1 |
111 | c | Cycle1 |
111 | d | Cycle1 |
111 | AB | Cycle1 |
111 | j | Cycle2 |
111 | k | Cycle2 |
111 | AB | Cycle2 |
111 | kl | Cycle3 |
111 | hg | Cycle3 |
111 | hgg | Cycle3 |
111 | AB | Cycle3 |
222 | a | Cycle1 |
222 | c | Cycle1 |
222 | d | Cycle1 |
222 | e | Cycle1 |
222 | AB | Cycle1 |
222 | aa | Cycle2 |
222 | ff | Cycle2 |
222 | AB | Cycle2 |
Try this
Table: LOAD RowNo() as RowNum, *, If(ID = Previous(ID), If(Previous(Data) = 'AB', RangeSum(Peek('CycleNum'), 1), Peek('CycleNum')), 1) as CycleNum, 'Cycle' & If(ID = Previous(ID), If(Previous(Data) = 'AB', RangeSum(Peek('CycleNum'), 1), Peek('CycleNum')), 1) as Output; LOAD * INLINE [ ID, Data 111, a 111, b 111, c 111, d 111, AB 111, j 111, k 111, AB 111, kl 111, hg 111, hgg 111, AB 222, a 222, c 222, d 222, e 222, AB 222, aa 222, ff 222, AB ];
Try like:
Load *, If(Data='AB', 'Cycle'&AutoNumber(Data&RowNo()),Output) as OutputNew
thanks for your response...NO its giving continues increment and that output field is required out put
Try this
Table: LOAD RowNo() as RowNum, *, If(ID = Previous(ID), If(Previous(Data) = 'AB', RangeSum(Peek('CycleNum'), 1), Peek('CycleNum')), 1) as CycleNum, 'Cycle' & If(ID = Previous(ID), If(Previous(Data) = 'AB', RangeSum(Peek('CycleNum'), 1), Peek('CycleNum')), 1) as Output; LOAD * INLINE [ ID, Data 111, a 111, b 111, c 111, d 111, AB 111, j 111, k 111, AB 111, kl 111, hg 111, hgg 111, AB 222, a 222, c 222, d 222, e 222, AB 222, aa 222, ff 222, AB ];
Please open a new thread to explain what the issue is and we can go from there?