Getting the day, month and year from planningdate

Z Solvertech
Verze z 14. 7. 2023, 12:48, kterou vytvořil FuzzyBot (diskuse | příspěvky) (Stránka aktualizována, aby odpovídala nové verzi zdrojové stránky)
(rozdíl) ← Starší verze | zobrazit aktuální verzi (rozdíl) | Novější verze → (rozdíl)
Skočit na navigaci Skočit na vyhledávání
Jiné jazyky:

How to extract day, month and year from planningdate (or any other date):

  1. Enable planningdate in ScenarioImporter <AddPlanningDateToDynamicColumns>true</AddPlanningDateToDynamicColumns>

  2. Create four dynamic columns, one for day, month, year and an auxiliary column from which the date will be extracted (within the example this will be plan for extraction and pland, planm and plany for day, month and year).

  3. <NotTypeConvertedDynamicColumns> <string>plan</string> </NotTypeConvertedDynamicColumns>
  4. <ColumnsConcatenate> <string>dynamic;plan;;dynamic;planningdate</string> </ColumnsConcatenate>
  5. Try importing the data and check the format of the "plan" column. In my case it is the format 2021-09-28. According to the separator character of the data, edit the following step (swap - after .)

  6. <ColumnsReplace> <string>dynamic;plan;-;X</string> </ColumnsReplace>

    Here we get something like 2021X09X28 in the plan column, which is enough to extract the month but not the day. Something needs to be done about this.

  7. <ColumnsCalculated> <string>dynamic;plan;dynamic;plan;;YdynamicplanZ</string> </ColumnsCalculated>

    This will make the plan look like Y2021X09X28Z

  8. Now you just need a simple sequence in columns calculated:

    <string>dynamic;pland;dynamic;pland;dynamic;plan;;dynamicplan><X01Z?01:dynamicpland</string> <string>dynamic;pland;dynamic;pland;dynamic;plan;;dynamicplan><X02Z?02:dynamicpland</string> <string>dynamic;pland;dynamic;pland;dynamic;plan;;dynamicplan><X03Z?03:dynamicpland</string>... <string>dynamic;planm;dynamic;planm;dynamic;plan;;dynamicplan><X01X?01:dynamicplanm</string> <string>dynamic;planm;dynamic;planm;dynamic;plan;;dynamicplan><X02X?02:dynamicplanm</string> <string>dynamic;planm;dynamic;planm;dynamic;plan;;dynamicplan><X03X?03:dynamicplanm</string>... <string>dynamic;plany;dynamic;plany;dynamic;plan;;dynamicplan><Y2021X?2021:dynamicplany</string> <string>dynamic;plany;dynamic;plany;dynamic;plan;;dynamicplan><Y2022X?2022:dynamicplany</string>...

The result? You have columns pland with the day, planm with the month and plany where the year is. And you can compare, calculate...