Forum Discussion

acesario's avatar
acesario
Contributor II
5 years ago
Solved

Looking for an expression to tie many to one

I would like to transform data as shown below. The idea is that M and W are associated with 8:00 start and 9:15 end (M,W=8:00-9:15). Tuesday and Thursday are associated with 14:45. M and W are currently separated by a comma, So are T and TH. M,W are separated from TU and TH by a ;

Current Structure > Desired Structure
“MEETING_DAYS”: “M,W;TU,TH”, >> “MEETING_DAYS”: “M**;W;TU;TH",
“MEETING_START_TIMES”: “08:00;14:45”, >> "08:00
;08:00**;**14:45;**14:45”,
“MEETING_END_TIMES”: “09:15;16:00”, >> 09:15;09:15;16:00;16:00

So, comma values are grouped semi colon separated values are not.
I’m not sure I’m explaining this well, but hoping there is an approach that can help with this.

5 Replies

    • acesario's avatar
      acesario
      Contributor II

      Excellent, and thanks for the great example of using split and join!

    • pvanteru's avatar
      pvanteru
      New Contributor

      Hi @bojanvelevski,

      Thank you for solving this.

      We got a small issue with the solution, as the Meeting days are not always two days, we need to associate start times and end times based on the number of days instead of only two times. For example the scenario will be as below

      “MEETING_DAYS”: “M,W; TU,TH; M,W,F”, >> “MEETING_DAYS”: “M;W;TU;TH;M;W;F",
      “MEETING_START_TIMES”: “08:00;14:45;13:00”, >> "08:00;08:00;14:45;14:45;13:00;13:00;13:00”,
      “MEETING_END_TIMES”: “09:15;16:00;14:00”, >> “09:15;09:15;16:00;16:00;14:00;14:00:14:00”