on 05-24-2016 4:56 AM
Hi Experts,
I have a BO like this as below
element name:Text;
node parentNode[0,1]{
element count:Amount;
}
when i query the BO i can't get parent node, the element count.
how can i get the element?
Best Regards,
Thanarat
Hi Thanarat,
You can use foreach loop to access the node elements.
var query = BOName.QueryByElements;
var selParams = query.CreateSelectionParams();
selParams.Add(query.ID.content,"I","EQ","123");
var results = query.Execute(selParams);
foreach(var result in results) {
foreach( var item in result.ParentNode){
// you can access node elements here.
var elementCount= item.count;
}
}
Best Regards,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanarat,
You could also create custom query and include both Root and Parent node in single query and then execute the query:
Refer to create query: http://help.sap.com/saphelpiis_studio_1508/studio_od_1508.pdf
Section: 8.3.3.4 Create a Query
Thanks, Pradeep.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You should read inside the loop or make a collection
for example
In BO
import AP.Common.GDT as apCommonGDT;
businessobject IDGenerator {
[AlternativeKey]element NewID:IntegerValue;
node ParentNode[0,1]{
element Count1:Amount;
}
}
in BeforeSave of Other BO where I am querying BO IDGenerator
Option 1 to read in loop
var qry = IDGenerator.QueryByElements.Execute();
foreach(var ins in qry){
var X = ins.ParentNode.Count1.content;
}
Option2 to read in local variable a
var coll : collectionof IDGenerator;
coll = qry.OrderByDescending(n => n.NewID);
var a = coll.GetFirst().ParentNode.Count1.content;
Regards
Sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.