cancel
Showing results for 
Search instead for 
Did you mean: 

Assigining ChooseList To a EditText Control

Former Member
0 Kudos
87

Dear Friends,

Please let me know whether I can assign a Chooselist and ObjectType to a EditText control while designing the form in Screen Painter.

Regards,

Noor

View Entire Topic
Former Member
0 Kudos

Yes you can do it at the screen painter level itself.

Regards,

Satish.

Former Member
0 Kudos

Hi Satish,

Thanx for you answer.

Noor

Former Member
0 Kudos

Hi Satish,

I have configured the Chooseformlist from screen painter but i am unable to get the CFL Picker in the edit text box. Do I need to set the Chooselist in my form also ? Please let me know.

Regards,

Noor hussain

Former Member
0 Kudos

When you are creating new cfl in screen painter you need to do set teh properties that is ChoosefromListUID and Choosefromlistalias of EditText.

eg: if you create the cfl of name CFL_2 of type accounts then in edittext property set

ChoosefromListUID=CFL_2

ChooseFromListAlias=AcctCode

Regards

Rupinder

Former Member
0 Kudos

Dear Rupinder,

I have set the properties but the Chooselist picker is not available in the Edit Text Control.

Regards,

Noor

Former Member
0 Kudos

You EditText is type of Integer or alphanumeric. if it is integer then CFL could not bind with Integer Type of Field cahnge it into alphanumeric.

Regards

Rupinder

Former Member
0 Kudos

Dear Rupiner,

Where should I change it in Screen painter or in Form code ? where can I find that property ?

Noor

Former Member
0 Kudos

Dear Noor

This is not a property , this is the datatype of your field. when you are adding a userdefined field make it of type alphanumeric not integer.

Regards

Rupinder

Former Member
0 Kudos

Hi,

I tried the solution suggested by you. But still I ma not getting the Choose List Picker in the Edit text.

Noor

Former Member
0 Kudos

Hi Noor,

1. Has said before, the field binded to the EditText/Column must be of type Alphanumeric.

2. Check your form's XML code to see if you have the following:

EditText with CFL


...
<item uid="EmpCode" type="16" left="95" tab_order="0" width="79" top="20" height="14" visible="1" enabled="0" from_pane="0" to_pane="0" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
	<AutoManagedAttribute>
		<Attribute id="2" description="editable" modeAdd="1" modeFind="1"></Attribute>
	</AutoManagedAttribute>
	<specific TabOrder="0" ChooseFromListUID="CFL01" ChooseFromListAlias="Code">
		<databind databound="1" table="@SEI_TSPROD" alias="U_EmpCode"></databind>
	</specific>
</item>
...

The code ChooseFromListUID="CFL01" ChooseFromListAlias="Code" will both assign the CFL to the EditText and tell the CFL which info to retrieve/compare to.

CFL definition


...
</items>
<ChooseFromListCollection>
	<action type="add">
		<ChooseFromList UniqueID="CFL01" ObjectType="OBJECT_ID" MultiSelection="0" IsSystem="0"></ChooseFromList>
		<ChooseFromList UniqueID="CFL02" ObjectType="OBJECT_ID" MultiSelection="0" IsSystem="0"></ChooseFromList>
		...
	</action>
</ChooseFromListCollection>
<DataBrowser BrowseBy="DocEntry"></DataBrowser>
...

Hope it helps,

Regards,

Vítor Vieira

Former Member
0 Kudos

Dear Vítor Vieira

Thanx a lot for your post. I am able to get the Choose list screen. But the selected value is not being populated in the EditText Control. Please correct me.

Regards,

Noor

Former Member
0 Kudos

Hi Noor,

You need to write the code for that.

Take a look at the SDK ChooseFromList samples, usually placed under C:Program FilesSAPSAP Business One SDKSamplesCOM UIVB.NET17.ChooseFromList.

Best Regards,

Vítor Vieira

Former Member
0 Kudos

Dear Vitor,

I tried the method suggested in the SDK samples. But I am getting exception while I am assigning the values to the edittext as

Item - Can't set value on item because the item can't get focus. [66000-153]

'CFL Event here

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then

Dim oEdit As SAPbouiCOM.EditText

Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent

oCFLEvento = pVal

Dim sCFL_ID As String

sCFL_ID = oCFLEvento.ChooseFromListUID

Dim oCFL As SAPbouiCOM.ChooseFromList

oCFL = oForm.ChooseFromLists.Item(sCFL_ID)

If oCFLEvento.BeforeAction = False Then

Dim oDataTable As SAPbouiCOM.DataTable

oDataTable = oCFLEvento.SelectedObjects

Dim val As String

Try

val = oDataTable.GetValue(0, 0)

Catch ex As Exception

End Try

If (pVal.ItemUID = "txtGRNNo") Then

Try

oEdit = oForm.Items.Item("txtGRNNo").Specific

oEdit.Value = val 'Getting Exception here

Catch ex As Exception

'Exception here

End Try

End If

End If

End If 'End Of CFL Event

Regards,

Noor hussain

Former Member
0 Kudos

Hi Noor,

That error occurs because, in the CFL event, when pVal.BeforeAction = False, the active form is the List Of ... form, not the base form itself. You than need to write the values directly to the base form's data sources (UserDataSource, DBDataSource or DataTable).

The following code will work if you have a


            Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent = pVal
            Dim sCFL_ID As String = oCFLEvento.ChooseFromListUID
            Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(FormUID)
            Dim oCFL As SAPbouiCOM.ChooseFromList = oForm.ChooseFromLists.Item(sCFL_ID)

            If oCFLEvento.BeforeAction = False Then
                Dim oDataTable As SAPbouiCOM.DataTable = oCFLEvento.SelectedObjects
                Dim val As String

                Try
                    With oForm.DataSources.DBDataSources.Item("@TABLE") '@TABLE is the name of the DBDataSource the form's connect to
                        .SetValue("U_txtGRNNo", .Offset, oDataTable.GetValue(0, 0)) 'U_txtGRNNo is the id of the field the EditText is connected to.
                    End With
                Catch ex As Exception
                End Try
            End If

Regards,

Vítor Vieira

Former Member
0 Kudos

Dear Vitor,

Thanx a lot for your post. Now I am not getting that error.

Regards,

Noor hussain

former_member648217
Participant
0 Kudos
 SAPbouiCOM.DataTable oDatatable;

            if (!pVal.BeforeAction)
            {
                if (pVal.SelectedObjects != null)
                {
                    oDatatable = pVal.SelectedObjects;
                    switch (pVal.ItemUID)
                    {
                        case "Field":
                            oForm.DataSources.DBDataSources.Item("@Table").SetValue("Field", 0, oDatatable.GetValue("FieldFromtheCFL", 0).ToString());
                            break;
                    }
                }
            }

hope it will help...

Regards,

Wilson de los antos

former_member648217
Participant
0 Kudos
 SAPbouiCOM.DataTable oDatatable;

            if (!pVal.BeforeAction)
            {
                if (pVal.SelectedObjects != null)
                {
                    oDatatable = pVal.SelectedObjects;
                    switch (pVal.ItemUID)
                    {
                        case "Field":
                            oForm.DataSources.DBDataSources.Item("@Table").SetValue("Field", 0, oDatatable.GetValue("FieldFromtheCFL", 0).ToString());
                            break;
                    }
                }
            }

before you use GetValue() you must check if the datatable is existing or not. because the pVal.SelectedObjects returns null before action...

hope it will help...

Regards,

Wilson de los santos

Edited by: Wilson De los Santos on Feb 1, 2010 8:54 AM