Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a variable called zDates which contains the dates. May I know how we can count the no of dates in the variable(zDates)?
zDates=('2015_01','2015_02')
--> In the above variable we have 2 dates.
I have another variable which also contains the dates. Since the above variable contains 2 dates I need to remove 2 dates from the starting(Which is '2014_01' and '2014_02') of the below variable. If the above variable contains 3 dates then it should remove 3 dates and so on.
zNewDates=('2014_01','2014_02','2014_03','2014_04','2014_05','2014_06','2014_07','2014_08','2014_09','2014_10','2014_11','2014_12')
Output:
zNewDates=('2014_03','2014_04','2014_05','2014_06','2014_07','2014_08','2014_09','2014_10','2014_11','2014_12')
Can someone help me out for the same please?
SET zDates="('2015_01','2015_02')";
Set zNewDates="('2014_01','2014_02','2014_03','2014_04','2014_05','2014_06','2014_07','2014_08','2014_09','2014_10','2014_11','2014_12')";
Let vNoOfDates = SubStringCount('$(zDates)',',')+1;
Let vCommaPos = Index('$(zNewDates)',',',$(vNoOfDates));
Let zFinalStr = '(' & Right('$(zNewDates)',Len('$(zNewDates)')-$(vCommaPos));
SET zDates="('2015_01','2015_02')";
Set zNewDates="('2014_01','2014_02','2014_03','2014_04','2014_05','2014_06','2014_07','2014_08','2014_09','2014_10','2014_11','2014_12')";
Let vNoOfDates = SubStringCount('$(zDates)',',')+1;
Let vCommaPos = Index('$(zNewDates)',',',$(vNoOfDates));
Let zFinalStr = '(' & Right('$(zNewDates)',Len('$(zNewDates)')-$(vCommaPos));
Sorry! Requirement got changed. The output of the variable is something like the below one.
zDates='SALES_FIN_M.2015_01','SALES_FIN_M.2015_02';
zNewDates='SALES_FIN_M.2014_01','SALES_FIN_M.2014_02','SALES_FIN_M.2014_03','SALES_FIN_M.2014_04','SALES_FIN_M.2014_05','SALES_FIN_M.2014_06','SALES_FIN_M.2014_07','SALES_FIN_M.2014_08','SALES_FIN_M.2014_09','SALES_FIN_M.2014_10','SALES_FIN_M.2014_11','SALES_FIN_M.2014_12';
Can you please help me out with the code when the Variable output is something like above.
If the change is only addition of ''SALES_FIN_M.' to your input, then above solution still works,
Else can you explain your requirement again?
Sure will let you know if it doesn't work out. By the way how we can remove ')' from zNewDates? Please help in the meantime.
Purgechar('$(zNewDates)',')')