cancel
Showing results for 
Search instead for 
Did you mean: 

XML Export Data Error with Nodes in Excel

former_member190818
Active Contributor
0 Kudos

Hello,

I've created a new BO for uploading data using File Input. My BO has one node in it. When I try to use the xsd file in Excel and convert to XML, I receive a message "Cannot save or export XML data. The XML maps in this workbook are not exportable".

I've gone through the blog

I've also checked the comments from all and I've asked to Rufat to send the working XML. I'm not getting any response in that. So I'm raising this thread to find a solution.

Can anyone please let me know what needs to be done to make it work?

Thanks.

Regards,

MB

Accepted Solutions (0)

Answers (2)

Answers (2)

may_thitsaoo
Contributor
0 Kudos

Hi Mohan,

I also tried that logic and it works for me.

You may need to have key (for root) and here are some logics.

KeyID  Root1    NodeData1 NodeData2 ...

504      ABC      AA                 12

504      ABC      BB                 34

FlatBO-Before-Save:

var root : elementsof MainBO;

var items : elementsof MainBO.items;

if(!MainBO.Retrieve(KeyID).IsSet()) {

  // Create new instance

  root.KeyID = this.KeyID;

  root.Root1 = this.Root1;

  var rootData = MainBO.Create(root);

  items.NodeData1 = this.NodeData1;

  items.NodeData2 = this.NodeData2;

  rootData.items.Create(items);

} else {

  // Update existing instance (adding items)

  items.NodeData1 = this.NodeData1;

  items.NodeData2 = this.NodeData2;

  MainBO.Retrieve(KeyID).items.Create(items);

}

Regards, May.

former_member190818
Active Contributor
0 Kudos

Thank you May !!! It helps....

Former Member
0 Kudos

Hi Mohan,

I've provided you an answer there. 😉

You have to create a Processor BO with flat structure. Then you write some snippet on BeforeSave to handle the creation of instances of your target BO. Finally, create XML File Input based on your Processor BO.


XML File Input DOES NOT support multilevel structure.


Hope this helps.

Fernando

former_member190818
Active Contributor
0 Kudos

Hello Fernando,

So I need to have another BO with flat structure? While loading file input, on BeforeSave write logic to create records to my BO which has nodes in it?

Am I getting right? Are there no other possibilities? Because in the blog, they mentioned some alternative solution which is not working for me.

Thanks.

Regards,

MB

Former Member
0 Kudos

Exactly!

This is the approach I have used in the past, several times. I'm not sure if there are any other workarounds for this...

The good part about this workaround is that you have a specific BO with single responsibility (mass upload).

former_member190818
Active Contributor
0 Kudos

Hello Fernando,

i just have a doubt on this approach. How the data is going to get processed when we have flat structure? Is it going to process one record at a time? If so, how can I segregate the data which is coming next to append in previous record which got created?

For example,

504ABC  Z14252016-06-282016-06-14NewMerit29089.68
504ABC  Z14252016-06-282016-06-14NewMerit3728.9

If I've above records which has same id 504 which got 2 entries. If I've flat structure in BO, it will have 2 entries. While uploading the data through XML file input, is it going to process single record at a time?

Can you please let me know when to update existing data and when to create new?

Thanks.

Regards,

MB

Former Member
0 Kudos

You should set a field/element for the root node (e.g. Sales Order ID) and for the subnode (e.g. Sales Order Item ID), and on your BeforeSave event you check if an instance with such root ID exists or not. Then you create or update it accordingly. Use "Retrieve()" on this case, which is faster!

former_member190818
Active Contributor
0 Kudos

Thank you Fernando !!!

Will do some test and let you know.

Regards,

MB