Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have a simple question and hope I'll find someone willing to help (@sunny_talwar )
I have 2 strings (no matter how they were constructed)
1) 45464748
2)454748
These strings are the concatenation of weeks; as u can see, the week 46 is missing in the second string.
I want to find a way to highlight this:
I tried using purgchar, purgechar(1,2) : but this returns 6 while I want to return 46 ...
Any idea?
Any help is much appreciated
Thanks Marcus,
I found out a way to do it when there ONE missing week:
if(len('45|46|47|48')=len('45|46|48'),'All weeks were imported', 'Week not imported : '&
SubField(
textBetween(
'45|46|47|48','|' , PurgeChar('45|46|47|48' , '45|46|48')) ,'|',-1)
&
PurgeChar('45|46|47|48' , '45|46|48')
)
result:
I doubt that there could be an easy and elegant solution within the UI especially if the strings could be really arbitrary and there might be also multiple missing parts. Therefore I think you would need multiple if-loop's for it ... You may start with something like:
if(len(S1) <> len(S2),
if(mid(S1, 1, 1) <> mid(S2, 1, 1),
....
I think there could be a quite ugly solution be constructed ... What speaks against a script-solution preverable without these string-stuff or at least with some adjustments, for example with a zero white-space as delimiter and similar measures.
- Marcus
Thanks Marcus,
I found out a way to do it when there ONE missing week:
if(len('45|46|47|48')=len('45|46|48'),'All weeks were imported', 'Week not imported : '&
SubField(
textBetween(
'45|46|47|48','|' , PurgeChar('45|46|47|48' , '45|46|48')) ,'|',-1)
&
PurgeChar('45|46|47|48' , '45|46|48')
)
result:
I seperate weeks by '|'
See, this solution works if there ONE missing week:
if(len('1|2|3|4')=len('1|2|4'),'All weeks were imported', 'Week not imported : '&
SubField(
textBetween(
'41|2|3|4','|' , PurgeChar('1|2|3|4' , '1|2|4')) ,'|',-1)
&
PurgeChar('41|2|3|4' , '1|2|4')
)
By several missing values an approach like the following might be useful:
purgechar(purgechar(purgechar(S2, subfield(S1, '|', 1) & '|'), subfield(S1, '|', 2) & '|'), ….
But like mentioned a script-solution might be more suitable maybe something like:
load * inline [ Week 45 46 48 ]; load distinct ReloadWeek as MissingWeek where not exists(Week, ReloadWeek); load week(today() - 35 + recno()) as ReloadWeek autogenerate 28;
- Marcus