0

Table function

By which I mean a function that can be called from any field/column in that Table.

 

I have a function to update a couple of fields based on the values of 2 other fields and really need to call that function when updating either of those 2 latter fields. I could just put the same code into the 'update' formula for both of those fields, but it's never a good idea to have to duplicate code.

 

I tried to create a Global function, but it doesn't know about the columns in the table with which I am working and trying to work around that requires a lot of messing around copying values back and forth between parameters and the actual fields.

 

I thought about adding the function to either the Table create or update formulas, but I cannot seem to then call the function from the fields that need to trigger them.

 

So, is there any way to create a 'Table function' that can be accessed from any field in that Table, in a similar way that 'Global functions' can be accessed globally?

2 replies

null
    • UKenGB
    • 2 yrs ago
    • Reported - view

    Ok, so maybe not a full 'table function', but I have a several fields whose 'trigger on update' needs to run the same code. Is it somehow possible to store this code somewhere and be able to call it from the update trigger of several fields?

     

    Currently having to keep the trigger code in sync across multiple fields is a nuisance while I'm still developing it. Would be great if I could just store it once and call that from multiple fields.

     

    Is it possible?

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi

     

    I have checked the order of execution and the field level Trigger after update fires before the record level Trigger after update. This means you could set a flag field at the field level

     

    flag := 1

     

    and the code can sit at the record level

     

    if flag then

    <your code here>

    flag := 0

    end

     

    Regards John

Content aside

  • 2 yrs agoLast active
  • 2Replies
  • 356Views