XML to BO


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
If all of those rows need to be set to dirty, the you can manually set each of those rows into a dirty state.

Me.CurrentDataTable.Rows(0).SetModified()

This will tell the BO that this record needs to be updated.  If it is a new record then use this method:

Me.CurrentDataTable.Rows(0).SetAdded()

Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
How do I save the BO with my newly added records then?



I tried putting it in edit mode, the save() then causes a collision.

Keith Chisarik
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I see them added, but they dont get saved.. is there something special about using CopyDataFrom?

When you copy the data in the CurrentDataTable rejects any previous changes.  If you look at the .IsDirty property before and after the copy, you will see that it will be False after the copy.

Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
great, sorry I missed that 2nd parameter.



Now why isnt the save committing the records back to the SQL server?



OrdersBO.CopyDataFrom(importedorder_datatable, MicroFour.StrataFrame.Business.BusinessCloneDataType.AppendDataToTableFromCompleteTable)

OrdersBO.Save()



I see them added, but they dont get saved.. is there something special about using CopyDataFrom?



If I manually do it, it does save.



Me.OrdersBO.newRow()

Me.OrdersBO.order_dt = DateTime.Parse(currow("order_ndt"))

Me.OrdersBO.Save()

Keith Chisarik
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Bug? or does vb.net just not like underscores in tablenames?

This would be related to .NET since we do not have control over the compiler.  But there is something not quite right because I know that I have done this in the past.

Also CopyDataFrom clears the contents of the current BO, is there something like AppendDataFrom? If not I can do it manually easy enough.

Look at the second parameter.  There is an option to append or clear.

Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Me.OrdersBO.CopyDataFrom(importedorder_datatable)



I get an error because CopyDataFrom thinks the table name is 2 parameters due to the underscore, it works fine if I remove it.



Bug? or does vb.net just not like underscores in tablenames?



I haven't had problems with underscores anywhere else, I generally have always used an underscore in any dynamic table name just as a personal convention, it helps me to identify them as dynamic.



Also CopyDataFrom clears the contents of the current BO, is there something like AppendDataFrom? If not I can do it manually easy enough.



Thanks

Keith Chisarik
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
Microsoft XSD Inference 1.0

The Microsoft XSD Inference utility is used to create an XML Schema definition language (XSD) schema from an XML instance document. When provided with wellformed XML file, the utility generates an XSD that can be used to validate that XML file. You can also refine the XSD generated by providing the tool more wellformed XML files. The download contains the core library, simple command line utility and the source code.



Package is attached



Smile
Attachments
xsdinference.zip (174 views, 246.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You can get it to work...I have done this on a number of occasions.  First, look at the ReadXmlSchema method on the DataTable.  Second, reverse engineer the WriteXml on the DataTable which has support for the schema.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can only read the XML file if it was written to the file using the business object's table.  When the table writes it's data to disk, there is an overload that allows you to tell it that you want to write the schema to file as well.  If you write the schema, then you can read the file and schema back in.
Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
"DataTable does not support schema inference from XML." is what I get when I try your code.



I tried a few difference XML documents.

Keith Chisarik
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search