on 09-20-2008 10:42 AM
Hi all,
i have created two tables(parent and child tables) with no object.
then i created two forms(parent and child forms).my requirement is when i click add in child form, all the data in child form should be assigned to a temporarytable and the childform should be closed.
after that when i click add in parent form the data in the parent form andin the child form should be added to the corresponding table.how should i achieve this.
Thanx in advance
Mohana
Mohana,
I've neved used tried it, but I guess you can use the Matrix's SerializeAsXML method. You read more about it in the SDK documentation.
Regards,
Vítor Vieira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mohana,
Description
Returns information about the matrix (the data and metadata) in XML format.
The schema of the XML is available using the GetSchema method.
Example
The following gets the XML from the matrix on the marketing document form (the example assumes the form is the active form).
SAPbouiCOM.Matrix matrix;
SAPbouiCOM.Form form = SBO_Application.Forms.ActiveForm;
SAPbouiCOM.Item item = form.Items.Item("38");
matrix = (SAPbouiCOM.Matrix)item.Specific;
String matrixXml = matrix.SerializeAsXML(SAPbouiCOM.BoMatrixXmlSelect.mxs_All);
Regards,
Vítor Vieira
thanx for helping me to solve the problem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mohana,
U have the Child form and the child table, when u fill this and click on add just store the data in the same table(But have another column which states that this is temporary data Ex : COlumn name - TData Col Values - Y-Yes,N-No) So when u click on the child form add they will be stored in the same table but with TData = Y .
And now when u work on the parent form if u feel that the conditions are satisfied then u just update the Child table rows by making TData = N. (So using this u need not use a temp table and add all the data again from the temp table to the child table but u just update a col.)
Did i make myself clear??
Hope this helps,
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vasu,
When i click Cancel, the updated record in the child table should be removed.
For eg:
In the Child Form,
I have added a value as 'Green' and click Add it will get updated in the child table.then i move to parent form and clicked add the record in the parent as well as in the child get added.when i click cancel the record in the child get deleted.now i pressed add.then again i load the child form update the 'Green' as 'Blue' then i click add in the child form it is updating in the child table.then i move to parent form and clicked cancel,At this time it should display hte previous vale 'Green'.I Hope u understood my problem.how should i achieve this...
Regards
Mohana
Well it would depend on ur requirement, u can use an XML too instead of the temp table.
Check the sample code with which u can read data frm an XML file...
Public Function GetConInfo(ByVal ConType As String) As String
Dim objXMLDoc As New System.Xml.XmlDocument
Dim objNode As Xml.XmlNode
Dim intLoop As Integer
objXMLDoc.Load(System.Windows.Forms.Application.StartupPath & "\ConnectionInfo.xml")
With objXMLDoc.GetElementsByTagName("Parameter")
For intLoop = 0 To .Count - 1
objNode = .Item(intLoop)
If objNode.Attributes("Type").Value = ConType Then
Return objNode.Attributes("Value").Value
End If
Next
End With
Return ""
End Function
and below is the format of the XML file to be read.
<root>
<Parameter Type="Destination" Value = ";Server=SAPServer;uid=sa;Pwd=sa;" />
<Parameter Type="DataBase" Value = "Database=Test1" />
<Parameter Type="Server" Value = "SAPServer" />
<Parameter Type="Uid" Value = "sa" />
<Parameter Type="Pwd" Value = "sa" />
<Parameter Type="Trust_Connection" Value = "false" />
</root>
Hope it helps,
Vasu Natari.
Hi Vasu,
I saved the childForm Data in the XML as :
Dim Ds As DataSet
Dim DataTable As DataTable
Dim DataRow As DataRow
Ds = New DataSet()
DataTable = Ds.Tables.Add("@PSSIT_CMPRMCAT")
DataTable.Columns.Add("Code", Type.GetType("System.Int32"))
DataTable.Columns.Add("Name", Type.GetType("System.Int32"))
DataTable.Columns.Add("PCode", Type.GetType("System.Int32"))
DataTable.Columns.Add("CValue", Type.GetType("System.String"))
DataTable.Columns.Add("TData", Type.GetType("System.String"))
For IntICount = 0 To oMatrix.RowCount - 1
oCodeEdit = oCodeCol.Cells.Item(IntICount + 1).Specific
oNameEdit = oNameCol.Cells.Item(IntICount + 1).Specific
oPIDEdit = oParIDCol.Cells.Item(IntICount + 1).Specific
oCValueEdit = oCValueCol.Cells.Item(IntICount + 1).Specific
oMatrix.GetLineData(IntICount + 1)
DataRow = DataTable.NewRow()
DataRow("Code") = oCodeEdit.Value
DataRow("Name") = oNameEdit.Value
DataRow("PCode") = oPIDEdit.Value
DataRow("CValue") = oCValueEdit.Value
DataRow("TData") = "Y"
Next
Ds.WriteXml(sPath & "\PSSIT_CMPRMCAT.xml", XmlWriteMode.WriteSchema)
End If
Then in the parent form i have to read the data from the XML and push the data into the table.
How should i achieve this.
Regards
Mohana
Hi Vasu,
this is my XML File Structure :
<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
- <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="_x0040_PSSIT_CMPRMCAT">
- <xs:complexType>
- <xs:sequence>
<xs:element name="Code" type="xs:int" minOccurs="0" />
<xs:element name="Name" type="xs:int" minOccurs="0" />
<xs:element name="PCode" type="xs:int" minOccurs="0" />
<xs:element name="CValue" type="xs:string" minOccurs="0" />
<xs:element name="TData" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
</NewDataSet>
Regards
Mohana
User | Count |
---|---|
99 | |
9 | |
9 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.