uBAQ Inside Function

I have a need to update a table inside of a function. This is part of a two pronged functionality for an integration I am working on; 1 thing reads a uBAQ for the data, and another thing will call a function to process the Write. The BAQ itself is a uBAQ. I currently have this exposed in an application and the write function is handled by the uBAQ, but I want to reduce the complexity of this by not requiring the full row to be written and instead want to handle it as a function with a small signature for request/response.
Would it be better to update the table directly inside of the Function using the table’s BO, or would it be better to use the dynamic query assembly to do this inside of a function?

I don’t know about “better”, but I have settled on using uBAQs within functions as my preferred approach, personally, using dynamic query. It feels more maintainable when carefully constructed, and means the a lot of the code can be standardised. Particularly with integrations, where I use conventions in the BAQ column labels to identify what needs to happen when the function calls the uBAQ.

I suspect that as you’re talking “small” and “reduced complexity” the table’s BO might be the way you’re leaning, though - it would be interesting to know what anyone else thinks.

And, of course, if you really want to optimise the write, you can always override the uBAQ’s code anyway.

3 Likes

IMO adding a ubaq inside the function just adds another layer of complexity
If you have access to the BO in the function what is the benefit of adding another layer in there?

Complicates error handling too. If there’s an issue at the BO now you need to send that down to the ubaq and from the ubaq to the function to eventually notify the user :man_shrugging:

4 Likes

Dependency Decoupling makes for scalable systems. I agree, function should do the trick. In E11 you can also do function-to-function calls.

4 Likes

At which point, the number of functions created will explode… in a good way.
It would be good if there was a widget in functions for ‘Fill Table From BAQ’ or something to kind of close the loop for epicor functionality.

1 Like

https://epicor-manufacturing.ideas.aha.io/

Thanks all. I was trying to be lazy and re-use the existing uBAQ but in this case, it’s much easier to write a new non-uBAQ for the “read” and implement a function with a table update for the “write”.