0

If field = null then 1

Honestly, this is going to be so obvious but I just cant figure it out D;

I have a number field "Version" I want to create a trigger after update formula that checks if "Version" is null, and if it is then populate with number "1"

I then have a button to duplicate/"revise" an order that takes that #1 and + 1 to get the new version number.

There's probably an easier way to just do it from trigger on create where it checks if there's any other records with the same "BLA #" and if there isn't, assigns "1" and if there is, counts how many and + 1... I just cant get it to work

...in saying that I haven't tried with a text field so I'ma go do that and if it works I'll post the results here, as usual.

1 reply

null
    • SECOS Group
    • quartz_cap
    • 5 yrs ago
    • Reported - view

    OKAY! I have the current solution:

    My "revise order" button that duplicates the record, I've kept the Version Nr + 1 formula that I had going

    For new records, I've used the following for trigger on create:

    let BLANr := '10. BLA'.'BLA Number';
    let VerNr := max(select 'BLA Form' where '10. BLA'.'BLA Number' = BLANr).number(Version);
    if cnt(VerNr) < 1 then Version := number(1)

     

    Like I said, I'm sure theres a better way. I just cant figure it out/get it to work.

Content aside

  • 5 yrs agoLast active
  • 1Replies
  • 1218Views