AnsweredAssumed Answered

odd behavior with if statement inside a replace

Question asked by gethappy@happypc.com on Jul 13, 2017
Latest reply on Jul 13, 2017 by philmodjunk

I had the following replace function inside a replace function running in a script ...

 

If( IsEmpty( table::field ); $variable )

 

and it was leaving a bunch of the found set empty.  So even though the value was empty (I can click in it and confirm there is no blank spaces or anything), it was not entering the variable value.

 

If I used this function inside the replace function instead ...

 

If( IsEmpty( table::field ); $variable ; table::field )

 

then it works fine.  All the found set gets replaced.  But ideally I don't want to use this second function, since I didn't want to alter the field (forcing a reindex) if no change was needed.

 

What's odd about this is that (I think) it worked fine for months, then suddenly this week it seems to be not working.  I have tried repairing the database just in case something was damaged, but no difference in the functionality.

 

Is the 1st function not valid?  I always thought it was ok to have an if statement without a corresponding else, but maybe not?

 

 

Outcomes