To call a function over and over in a loop or just send a dataset to a function and iterate through that dataset in the function to create a tableset to use in a BO method call- which one would be better? Or should I do neither of them?

I am going to make an updatable dashboard to loop through transfer order shipments that we wish to add to a BOL. For each result I was going to call a function that I would pass parameters to that would add that pack to the BOL. So if I have 50 packs, I would call the function 50 times.

Would it be better to create a dataset of the packs in the updatable dashboard BPM and pass that to the function all at once and then iterate through the dataset on the function side to build the BOLSlip data table needed for the BOLImpl.UpdateLinks method?

If I am not being clear please let me know.


@utaylor you should earn a sticker for longest question ever!



The answer: Yes it would be better.


Yeah I thought about not posting that title because… well, it’s annoying. haha

I am with you, is it better because it takes less time to execute, less overhead?

I am just not sure.

On one hand if I call the function one line at a time then I pass a few parameters and create the datatable in the function consisting of that one line and I’m done.

On the other hand I could iterate through all the lines in my updatable BAQ, create a dataset in the BPM, pass the dataset to a dataset parameter in the function (which also is created taking up space) AND THEN iterate through the parameter to create a datatable from it.

Not sure either way how to define better. I would think you would measure it in execution time and compute resources needed.

How many records do you need to loop over and how often?

Does the simple approach perform adequately?

make sure you get the right balance of performance and complexity.


1 Like

How about two functions, one in which you send all the data, and inside that function a loop which calls another function that processes only one item based on the parameters?

This depends on what the actual BO will be doing, so I could be wrong, but if the overhead is on time between the calls from Client to Server and back, then this approach would eliminate that.

Now if the actual function that processes the items does take a lot longer doing one at a time vs everything together, then in that case maybe it is best to do everything.


Thanks everyone, I will try both out and see what the result is.