on 07-25-2014 5:50 AM
Hi Experts,
I am trying to load CFL from XML file.I am using the following XML and Vb.Net code but it is giving -1106 error while loading.
XML File:
<choosefromlist UniqueID="CFL_4" ObjectType="2" MultiSelection="0" IsSystem="0>"
<conditions>
<condition alias="CardCode" bracket_close_num="0" bracket_open_num="0" compare_fields="0" compared_field_alias="" cond_end_val="" cond_value="C0001" operation="1" relationship="99" use_result="0" />
<condition alias="CardCode" bracket_close_num="0" bracket_open_num="0" compare_fields="0" compared_field_alias="" cond_end_val="" cond_value="ttt" operation="1" relationship="0" use_result="0" />
</conditions>
</choosefromlist>
Load From XML:
Dim oCFL As SAPbouiCOM.ChooseFromList = objForm.ChooseFromLists.Item("CFL_4")
Dim oConds As SAPbouiCOM.Conditions
Dim oCond As SAPbouiCOM.Condition
Dim oEmptyConds As New SAPbouiCOM.Conditions
Dim rsetCFL As SAPbobsCOM.Recordset
rsetCFL = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oCFL.SetConditions(oEmptyConds)
oConds = oCFL.GetConditions()
oCond = oConds.Add()
oConds.LoadFromXML("CFLList.xml") 'Error -1106 Here
Please suggest
Thanks and Regards
DEV
Hi Dev,
For many reasons, your code will just not work...
If you have the xml definition of the CFL (as in your code excerpt), you have to call a LoadBatchAction to update the form, but the easiest is to copy your xml fragment into the srf/xml definition of your form.
Regards,
Eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dev,
srf files, which are saved by the ScreenPainter add-on are "just" xml files: so easy to read and to modify
When you design your form, on all EditText field you are able to assign a CFL (ChooseFromListUID and ChooseFromListAlias attributes of the <item><specific> element).
This CFL is also defined in the srf-xml file (at the full bottom). If you edit this file you can modify the definition of the CFL and set the conditions; to do it:
By doing so, your form will be loaded with the CFL fully defined.
If you look at the header of the srf-xml file, you'll find something like <Application><forms><action type="add"> ...
The type of the action can also be update (<action type="update">) in which case, the xml fragment can be loaded with the LoadBatchAction function to update the specified form.
Besides these two points, the ChooseFromList element in your xml is not correctly cased: it should like I write it and not like you did.
Regards,
Eric
Hi Dev,
This was not expressed and changes things a bit, for sure.
The rsetCFL object is not used (at least in your fragment) and from your code has to be removed,
The oCond = oConds.Add() will crash,
I'm not sure that the ChooseFromList (bad case in your fragment) is necessary...
In all cases, what I would do is to set the first condition by program, then export it with the Conditions.GetAsXML method. From there, I just would reproduce the structure with the correct values.
Regards,
Eric
Hi Indhu,
This is all except correct.
Process from the SDK is the following:
As described, Dev's process is correct, what he is missing is the exact syntax for the xml, and the way to get it was provided in a previous answer:
Regards,
Eric
User | Count |
---|---|
99 | |
11 | |
10 | |
6 | |
5 | |
5 | |
4 | |
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.