cancel
Showing results for 
Search instead for 
Did you mean: 

How to get data from different BO in ByD

Former Member
0 Kudos

Hi Experts,

I'd like to show some data from the other BO(there is just BO no screen) to the screen of main BO (BO has created screen)

as can see pic above, i want to get data from Preventive BO to show on the interface

they are the same element.

I don't know if i can do that?

Best Regards,

Thanarat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

You can the data from the BO as you want by writing some codes in absl file.

(eg.Action-getPreventive.absl).

This is sample codes in which getting data from InboundDelivery Bo.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

import ABSL;

import AP.LogisticsExecution.Global;

// declare variables
var query;
var selectionParameters;
var queryResult;

// initialize query and parameters

query = InboundDelivery.QueryByElements;
selectionParameters = query.CreateSelectionParams();

// set query parameter (retrieve all with ID = 4711 )
selectionParameters.Add( query.ID.content, "I", "EQ", “4711”);

// execute query
queryResult = query.Execute(selectionParameters);

// get data by loop

foreach (var item in queryResult) {

     // get and set the values as you want

}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Best Regards,

Thiri

Former Member
0 Kudos

Hi Thiri,

I want to get data from my BO in my solution i don't know what library i should import to my BO

Regards,

Thanarat

Former Member
0 Kudos

Hi Thanarat,

If "Preventive" is your custom BO, no need to import the library.

You can retrieve directly.

For example:

imoprt ABSL;

var query;

var selectionParams;

var queryResult;

query = Preventive.QueryByElements;

selectionParams = query.CreateSelectionParams();

// You can add parameter as you want then execute the query

queryResult = query.Execute(selectionParams);

Best Regards,

ThiriZun

Former Member
0 Kudos

Hi ThiriZun,

Yeah, i got it, so how can i show the data on a QA floor of the main BO.

actually, i have the same element of Preventive BO in Main BO, so i want to show the data from Preventive BO on the QA floor and then save it to the Main BO after clicking save button.

Best Regards,

Thanarat

former_member186648
Active Contributor
0 Kudos

Hi Thanarat,

Follow these steps:

1. Bind the UI to the Preventive BO Query,
2. Create BeforeSave event on Preventive BO -> Select the node where you have the query,

3. In the above event Query the Preventive BO data and create same data into the Main BO

Thanks, Pradeep.

Former Member
0 Kudos

Hi Thanarat,

According to your requirements,

after retrieving the data, you also need to save the data in your BO.

Here is the example of creating(saving) data in standard BO.

You can refer for your custom BO.

import ABSL;
import AP.LogisticsExecution.Global;

// define root node
var elInboundDelivery_Root: elementsof InboundDelivery;
var instInboundDelivery;
var elInboundDelivery_Item: elementsof InboundDelivery.Item;
var instInboundDelivery_Item;
var elInboundDelivery_ItemPORef: elementsof InboundDelivery.Item.ItemBusinessTransactionDocumentReference;
var instInboundDelivery_ItemPORef;

// mandatory: set ProcessingTypeCode and ID
elInboundDelivery_Root.ProcessingTypeCode = "SD";
elInboundDelivery_Root.ID.content = "4711";
// mandatory Vendor Party ID is derived from PO reference set below
instInboundDelivery = InboundDelivery.Create(elInboundDelivery_Root);

// mandatory: create at least one standard item
instInboundDelivery_Item = instInboundDelivery.StandardItem.Create(elInboundDelivery_Item);

// mandatory: create item reference to existing PO 815 item 10
elInboundDelivery_ItemPORef.BusinessTransactionDocumentReference.ID.content = "815";
elInboundDelivery_ItemPORef.BusinessTransactionDocumentReference.ItemID = "10";
instInboundDelivery_ItemPORef = instInboundDelivery_Item.ItemBusinessTransactionDocumentReferencePurchaseOrder.Create(elInboundDelivery_ItemPORef);

// optional: release inbound delivery task-based = true
instInboundDelivery.Release( true );

// optional: release inbound delivery task-based = true
instInboundDelivery.Release( true );


Remark:
You should use CustomBO.Create() method for your custom BO.


Best Regards,
Thiri

Former Member
0 Kudos

Hello,

I have an issue retrieving standard BO(CUSTOMER) from event-after modify using absl.

My requirement is that i have to pass the customerID and get the responsible employee id.

I am able to pass the parameter, but in response i am getting only the root level elements and not all the associations, nodes.

Can someone help me with this.

Please find the attachment for more details

former_member186648
Active Contributor
0 Kudos

Hi Mani,

ExecuteDataOnly returns data for the Node only which is also read only data

Thanks, Pradeep.

Former Member
0 Kudos

Hi Pradeep,

Thanks for the information.

Regards,

MANI

Answers (1)

Answers (1)

sunil1101
Employee
Employee
0 Kudos

Hi

Solution 1.  In your Main BO define association targeting to Preventive BO.

ex

association ToPreventive to Preventive;

then in absl set this association. In UI use this association to bind your data

Note: Association support 0..1 or 1..1 multiplicity, since you want to add as a list which will not support here.

Solution 2: in Data Model bind your data list (this may be under root of main BO) with Previnting BO.

- in Controler tab Create a new Query and for this query seletc BO model "Preventive BO"

- Bind Query with QueryByElements

-  In General tab select AdvanceListPane for your tab and in property Defaultset Mapping select Defualt set.

You can configure your default set and pass parameter to filter the results.

Data of other BO will be shown in existing UI(created for other BO)

Regards

Sunil

Former Member
0 Kudos

Hi Sunil,

I got an error ->[Activate] Target 'Preventive' is ambiguously specified. It exist as other business object as well as node inside this business object

i can't activate the BO

what should i do next?

Regards,

Thanarat

sunil1101
Employee
Employee
0 Kudos

Hi

Can you share your code? I guess you have used same name twice in same BO.

You should try second option for your requirement

Regards

Sunil