Create a unique id in crystal reports

2019-08-21 17:54发布

问题:

I have created the formula shown in code's window to show "via" wheneverenter image description here there is more than one pickup consecutively.

It works great but whenever "Via" shows up in Crystal report, I want to display as Via1, Via2 ....etc.

`If {Command.ACTIVITY}= 'Pick' and 
(previousISNULL ({Command.PASSONBOARD}) or previous 
({Command.PASSONBOARD})="")
 and next ({Command.ACTIVITY})='Pick'
 then "Via"
  else ""`

回答1:

Use a variable.

Try something like this:

shared numbervar counter;
If {Command.ACTIVITY}= 'Pick' and 
(previousISNULL ({Command.PASSONBOARD}) or previous 
({Command.PASSONBOARD})="")
 and next ({Command.ACTIVITY})='Pick'
 then counter := counter + 1;
 "Via" + cstr(counter)

Observe there are parenthesis in "then" clause.