cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Parent Form and Child Form

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Vitor,

I didnt get information about matrix's SerializeAsXML method.please proveide some more information about that.Iam using B1 2005.

Thanks

Mohana

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Vitor,

Iam using B1 2005,I didn't get matrix.serialize method. How to achieve this.

REgards

Mohana

Former Member
0 Kudos

Mohana,

Instead of saving the data in a temp table, how will it be if u can have a FLAG column in ur required table and only once the conditions are satisfied then u can just update the FLAG and use.. I guess this serves ur purpose.

Hope it helps,

Vasu Natari.

Former Member
0 Kudos

Hi Vasu,

When i click Add in the parent form then i have to get all the data from the child form and load it into the table.If i cancel the add then the child table,it should not save any data in the child table.How should i achieve this..

Regards

Mohana

Answers (2)

Answers (2)

Former Member
0 Kudos

thanx for helping me to solve the problem

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Vasu,

If i update the previously added record and click add means it is updating the record.when i move to parent form and then when i click cancel instead of add then i should retain the previous record instead of getting the newly updated record.How should i achieve this.

Regards

Mohana

Former Member
0 Kudos

Plz check the mail that i have sent u.

Vasu Natari.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Will it not be possible to add a new Temp child table to store the child records for the temporary purpose.

Vasu Natari.

Former Member
0 Kudos

Hi Vasu,

Insted of using temptable, should i use xml means will it get solved or not ? If so, give some sample for the xml.

Regards

Mohana

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Vasu,

How to read a data from the XML and fill all the records in the datasource.

Regards

Mohana

Former Member
0 Kudos

Did u execute the above function and check. It returns the values from the XML file, and the content in the XML file should be as in the sample provided.

R u getting any error..?

Vasu Natari.

Former Member
0 Kudos

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

Former Member
0 Kudos

Plz check out the function that i have posted earlier, u need to modify it according to ur XML file structure. Just check it up once. and Search google for samples to read XLM data frm a file.

And post ur XML file structure. SO that i can have a look and help u if possible.

Vasu Natari.

Former Member
0 Kudos

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