Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Thanks for your help in advance. Please help how to write script for the following requirement.
| Original Data | |
| Programs | Year |
| a | 2021 |
| ab | 2021 |
| abc | 2022 |
| abcd | 2022 |
| abcde | 2023 |
| abcdef | 2024 |
| Data format to be prepared Like this | ||
| Program | Year | New Year |
| a | 2021 | 2021 |
| ab | 2021 | 2021 |
| a | 2021 | 2022 |
| ab | 2021 | 2022 |
| abc | 2022 | 2022 |
| abcd | 2022 | 2022 |
| a | 2021 | 2023 |
| ab | 2021 | 2023 |
| abc | 2022 | 2023 |
| abcd | 2022 | 2023 |
| abcde | 2023 | 2023 |
| a | 2021 | 2024 |
| ab | 2021 | 2024 |
| abc | 2022 | 2024 |
| abcd | 2022 | 2024 |
| abcde | 2023 | 2024 |
| abcdef | 2024 | 2024 |
Hi,
maybe one solution could be:
table1:
LOAD * INLINE [
Programs, Year
a, 2021
ab, 2021
abc, 2022
abcd, 2022
abcde, 2023
abcdef, 2024
];
table2:
LOAD *, Year+IterNo()-1 as NewYear
While Year+IterNo()-1<=MaxYear;
LOAD *, Alt(Peek(MaxYear),Year) as MaxYear
Resident table1
Order By Year desc;
DROP Table table1;
hope this helps
Marco
Hi,
maybe one solution could be:
table1:
LOAD * INLINE [
Programs, Year
a, 2021
ab, 2021
abc, 2022
abcd, 2022
abcde, 2023
abcdef, 2024
];
table2:
LOAD *, Year+IterNo()-1 as NewYear
While Year+IterNo()-1<=MaxYear;
LOAD *, Alt(Peek(MaxYear),Year) as MaxYear
Resident table1
Order By Year desc;
DROP Table table1;
hope this helps
Marco
Hi MarcoWedel,
Thank you so much. Perfect solution .
once again Thank You so much.
Regards
Krish