Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 16 May 2014 at 5:11am
local numbervar same;
local numbervar i;
for i:=1 to len({table.field1}) do(
if left({table.field1}, i) = left(table.field2, i) then
same := i;
)
{table.field1} + "\" + mid({table.field2}, same +1)
this is assuming that the lengths are the same...otherwise, while the value will be correct, it will probably not accurately reflect the relationship between the values.
this logic can probably be expanded for more variables, but would have to be adjusted. There might be a more elegant way to do the same for n comparisons...
Either way, this would probably work (I always forget the syntax for the loops in CR as I almost never use them) (ie check Help)
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 19 May 2014 at 5:25am
my code should work, it would have to be a group footer...
I would probably modify it to something like this:
in the group header the reset:
shared stringvar orig:={table.field};
shared stringvar result := orig;
""//hide the result
in the detail section:
shared stringvar orig;
shared stringvar result;
shared stringvar cur := {table.field};
local numbervar i;
local numbervar same;
for i:=1 to len({table.field1}) do(
if left(orig, i) = left(cur, i) then
same := i;
);
result:= result + "\" + mid(cur, same +1);
""
finally in the group footer
shared stringvar result
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum