Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello ,
I have this flattened table from previously loaded json tables. My requirement is to insert rows before and after each column segment ; above to insert a row with a specific timestamp that i already have in a resident table,and below to insert another with a function such as today() or now(), and as a third requirement to insert in the below row a value from above row but from a different column. I'm getting stuck in the process of iterating through these segments. Could anyone point me in the right direction?
Event ID | Name | Timestamp | from Value | to Value |
Tiq | Prev table date | 'Origin' | ||
1 | Tiq | 01/01/2020 | A | B |
2 | Tiq | 03/01/2020 | B | C |
Tiq | today() | C | ||
Dda | Prev table date | '0rigin' | ||
3 | Dda | 15/01/2020 | A | B |
4 | Dda | 03/01/2020 | B | C |
5 | Dda | 06/01/2020 | C | A |
6 | Dda | 08/01/2020 | A | D |
Dda | today() | D | ||
Pic | Prev table date | 'Origin' | ||
7 | Pic | 13/02/2020 | A | C |
8 | Pic | 15/02/2020 | C | D |
9 | Pic | 24/04/2020 | D | A |
Pic | today() | A |
With black colour i'm showing what data i have so far, and with green what i need to be inserted for each segment of 'Name' field. 'Origin' string will remain the same for all rows created above each segment, whereas 'D' for example is dependent on previous row shifted by 1 column; so the value for the row under should take the value of the previous row shifted by 1 column.
Mention: the table is Ordered by name and within the segment by timestamp as a general rule
Thanks in advance.
I solved it in the end. If anyone needs to know for this specific case drop a reply