I have a number list where I have to remove 1 element from it based on user selection. This formula works just fine except if the first or last element of the list has to be removed.
Now, I know it’s because when I set QTYBef or QTYAft equal to “” when Before or After is equal to 0. My solution is below under “Last Line Rewritten”.
What I want to know is how do I avoid the @if statement in the last line of code. What do I set the fields QTYBef & QTYAft to other than “” so Notes accepts it and performs the operation? Right now it basically ignores that line of code with an error.
Thanks for your help, Quin
Here’s the code:
Before := @TextToNumber(Selection) - 1;
After := @Elements(Row) - @TextToNumber(Selection);
QTYBef := @If(Before=0;“”;@Subset(QTY;Before));
QTYAft := @If(After=0;“”;@Subset(QTY;(After*(-1))));
FIELD QTY := QTYBef : QTYAft
Last Line Rewritten:
FIELD QTY := @If(QTYBef=“”;QTYAft; QTYAft=“”;QTYBef; QTYBef : QTYAft);