How do I extract results from erp-function into TransView

I created am efxGetOrgUnitPrice event in Application Studio shown on the right.

image

The function call is pulling back json that looks like the second image on the right.

image

I added the column CSMCost to the TransView data view.

In my row update, I set the Ep Binding to TransView.CSMCost and the value to
“{actionResult.Result.Results[0].Calculated_CustomerCost}”, but when debugging and looking at the TransView I only see [object Object].

What am I doing wrong?

Since you’re returning a dataset, you should bind it to a dataview and then do the row update.

After that, you can bind your TransView.CSMCost to CreatedDataviewName.Calculated_CustomerCost

1 Like

OK for the really dumb question, how do you know I’m returning a dataset? Is it because more than one row is returned?

Yes. Your JSON is showing an array which generally corelates to a dataset.

Otherwise, if you were just assigning values to your Out Parameters, it would look something like this:

{"OutIntVal":15}

Which would then allow you to use {actionResult.OutIntVal}

I set up my Data View per the image.

I started the preview, selected the Debug Tool from the Overflow menu and triggered the event. The log indicated that the call to the library was successful, but when I looked at the MyCostAndPrice in the debug window I saw nothing. I assume that I failed to set up my Data View correctly. Does this make sense to you?

You just need the name.

What do your function widget response properties look like?

Interesting–that all looks okay.

After your function runs, go into Dev Tools, enable debugging and dump the views. Go to System Dataviews and drop down actionResult.
Do you see your Result column in there?

It should look similar to this, but where mine says OutDS yours would say Result.

1 Like

Not sure how to navigate to system data views in 2022.2.27, but I was able to find the actionResult data view.

Using the console (like in my screenshot) is going to give you better results.

How To: Debugging Kinetic (Browser) - Experts’ Corner - Epicor User Help Forum

Does this make sense to you?

Click in the Epicor windows and press CTRL + ALT + 8 to enable debugging.
Then press CTRL + ALT + V to dump the views.

Show me what’s in your MyCostAndPrice.

Sorry, I just realized that. Here’s the initial screen.

And here are the dataviews.

Here’s the System DataView that I think we want to look at.

image

Part of me wants to chalk this up to the version you’re on because everything looks to be setup correctly.

Alternate route question:
Are you expecting this to only ever return one row like it shows in your example there?
If so, I would edit the function to include 3 Out parameters: CSMCost, CustomerCost, and PartNum and set the values from within the function. That way you can utilize the {actionResult.CSMCost} syntax.

This function was created by another developer to accepts a list of part numbers and then return each parts information. I don’t want to change that function, but I guess I could write me own.

The developer who wrote the Erp Function said that it’s basically just a wrapper function that calls a BAQ and he’s wondering if we would have the same problem (Trying to assign object in epBinding) if I called the BAQ directly.

Just because I’m tired and am prone to the occasional dyslexia, swap these two and see if it works.

If that does not work, delete all of the widgets from the event, save it, and remake it. Sometimes App Studio is glitchy–especially in v2022.

Give it a shot. If you’re only using singular values in this screen, this would make the most sense.