How to set condition in choose from list based on the combo selection

Dear Members,
     i have a requirement to filter the item based on the itemgroup. After choosing the itemgroup in the dropdown list i have to filter the item for the particular group in the choose from the list.since i have tried in the combo select it doesnt work out for me.any body can suggest me is it doable. if so pls tell me the work around.
My coding is as follows..
Case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT
if pval.itemUID="Cmb"
                            objChooseCollection = objForm.ChooseFromLists
                            objChooseFromList = objChooseCollection.Item("CFL1")
                            objConditions = objChooseFromList.GetConditions()
                            objcondition = objConditions.Add()
                            objcondition.Alias = "itmsgrpcod"
                            objcondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                            objcondition.CondVal = Form.items.item("Cmb").specific.selected.value
                            objChooseFromList.SetConditions(objConditions)
End if
With Regards,
jai.
Edited by: JaiShankarRaman on Dec 23, 2009 10:47 AM

Hello,
Following is a code sample which I am using:
        Dim oForm As SAPbouiCOM.Form
        Dim oMatrix As SAPbouiCOM.Matrix
        Dim oChooseFromList As SAPbouiCOM.ChooseFromList
        Dim oConditions As SAPbouiCOM.Conditions
        Dim oCondition As SAPbouiCOM.Condition
        Dim CodeType As Integer
        Try
            oForm = oPayOn.SBO_Application.Forms.GetForm(CflEvent.FormTypeEx, CflEvent.FormTypeCount)
            oMatrix = oForm.Items.Item("AC_MATRIX").Specific
            oChooseFromList = oForm.ChooseFromLists.Item("ACC_CFL1")
            CodeType = oMatrix.Columns.Item("AC_MC00").Cells.Item(CflEvent.Row).Specific.Selected.Value
            oConditions = oChooseFromList.GetConditions
            If oConditions.Count > 0 Then
                oCondition = oConditions.Item(0)
            Else
                oCondition = oConditions.Add
            End If
            oCondition.Alias = "U_CodeType"
            oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
            oCondition.CondVal = CodeType
            oChooseFromList.SetConditions(oConditions)
        Catch ex As Exception
            'oPayOn.SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, True)
        End Try
    End Sub
I am calling this in the CFL event - before action. So when the user clicks on CFL button - but before it opens - this code is called and the condition is applied. Here AC_MC00 is a combo column in a matrix.
Regards
Rahul Jain

Similar Messages

  • Multiple Values For one Condition in Choose From List

    I have used one Business Partner Choose From List in my form but i want to give condition in that choose from list on GroupCode .But the condition will have multiple values like 100,102,104 then how i will write the code to incorporate multiple values for one single condition.

    Hi,
    Check this thread
    How to set a Multiple condition in a single CFL
    Hope that helps,
    Vasu Natari.

  • Delete/Edit/Update CFL Conditions - Choose From List

    Hi All,
    I have a Choose From List of which the conditions are set depending on a ComboBox.Selected.Value
    oCon.CondVal = comboboxBranch.Selected.Value
    So the Conditions are set when the "OnAfterComboSelect" event is trigered.           
    How do I reset the Condition when the user "RESELECTS" another ValidValue on that ComboBox???
    At the moment, on the Reselection on the Combobox, the CFL is returning EMPTY.....
    Thanks

    Hi Michael,
    Thanks for the speedy reply.  Its workin.
    Here's my code for the adding/editing of the Conditions from within the an Event Handler if any1 needs it.
    In the OnAfterFormLoad Event Handler:
    Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
    Dim oCFL As SAPbouiCOM.ChooseFromList
    Dim oCons As SAPbouiCOM.Conditions
    Dim oCon As SAPbouiCOM.Condition
    Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
    ' Adding CFL3 for Line GL Account Name.
    oCFLCreationParams.MultiSelection = False
    oCFLCreationParams.ObjectType = "1"
    oCFLCreationParams.UniqueID = "CFL3"
    oCFL = oCFLs.Add(oCFLCreationParams)
    In the 1st TabOrder Item's OnGotFocus Event Handler:
    oColumn = oColumns.Item("AcctCode")
    oColumn.ChooseFromListUID = "CFL3"
    oColumn.ChooseFromListAlias = "FormatCode"
    In the OnAfterComboSelect Event Handler:
    oCFLs = form.ChooseFromLists
    oCFL = oCFLs.Item("CFL3")
    oCons = oCFL.GetConditions()
    If oCons.Count = 0 Then
                    oCon = oCons.Add()
                    oCon.BracketOpenNum = 2
                    oCon.Alias = "GroupMask"
                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                    oCon.CondVal = "7"
                    oCon.BracketCloseNum = 1
                    oCon.Relationship = BoConditionRelationship.cr_AND
                    oCon = oCons.Add()
                    oCon.BracketOpenNum = 1
                    oCon.Alias = "Postable"
                    oCon.Operation = BoConditionOperation.co_EQUAL
                    oCon.CondVal = "Y"
                    oCon.BracketCloseNum = 1
                    oCon.Relationship = BoConditionRelationship.cr_AND
                    oCon = oCons.Add()
                    oCon.BracketOpenNum = 1
                    oCon.Alias = "Segment_1"
                    oCon.Operation = BoConditionOperation.co_EQUAL
                    oCon.CondVal = comboboxBranch.Selected.Value
                    oCon.BracketCloseNum = 2
                    oCFL.SetConditions(oCons)
    Else
                    oCon = oCons.Item(2)
                    oCon.CondVal = comboboxBranch.Selected.Value
                    oCFL.SetConditions(oCons)
    End If

  • Choose from list - data display with condition

    Hi,
    I 've developed a form using screen painter, I ' ve attached a choose from list to fill GRPo Number.  In the choose from list the GRPo no. should not display again which once I have selected and saved. 
    Let me have a good solution please and it would be appreciated.
    Thanks & Regards,
    Venkatesan G.

    Hi suresh,
    where did you put this code?....In the choose_from_list event handler?..I've tried a similar solution, before reading your post, but it doesn't work because if i dynamically set the condition for the choose from list i got an empty table.
    i've tried to put my code when beforeaction=true and i have this kind of problem. The difference is that i need to set the filter starting with the value i've entered on the field connected to the choose from list. I put code here, so it's more clear
    If (pVal.Before_Action = True) And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) Then
                        Dim oCFL As SAPbouiCOM.ChooseFromList
                        Dim oCons As SAPbouiCOM.Conditions
                        Dim oCon As SAPbouiCOM.Condition
                        Dim sItemCode As String
                        oEditText = oMatrix.Columns.Item("V_ItemCode").Cells.Item(pVal.Row).Specific
                        sItemCode = oEditText.Value.ToString
                        oCFL = oForm.ChooseFromLists.Item("CFL_Item")
                        oCons = oCFL.GetConditions()
                        oCon = oCons.Add()
                        oCon.Alias = "ItemCode"
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_START
                        oCon.CondVal = sItemCode
                        oCFL.SetConditions(oCons)
                    End If
    My situation is that i type something in V_ItemCode column and after that i press the tab key to open the choose from list.
    Would be ok if i get the SAP standard beahviour too, that doesn't open the choose from list, but fills the field with the first code starting with what you type.
    Thanks in advance

  • Choose From List Condition

    Dear Experts,
    i want to select Items in Sales Quotation Screen  which is from Particular Group, I'm using following code
    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST And pVal.BeforeAction = True Then
                If pVal.FormTye = "149" And pVal.ItemUID = "38" And (pVal.ColUID = "1" Or pVal.ColUID = "3") Then
                    Try
                        oForm = SBO_Application.Forms.ActiveForm
                        Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent = pVal
                        Dim sCFL_ID As String = oCFLEvento.ChooseFromListUID
                        Dim oCFL As SAPbouiCOM.ChooseFromList = Nothing
                        oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                        oCons = Nothing
                        oCon = Nothing
                        oCons = oCFL.GetConditions()
                        oCon = oCons.Add()
                        oCon.Alias = "ItmsGrpCod"
                        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                        oCon.CondVal = "100"
                        oCFL.SetConditions(oCons)
                    Catch ex As Exception
                        SBO_Application.MessageBox(ex.Message)
                    End Try
                End If
            End If
    First time  Its working fine. but i'm selecting the next time in next row or same row its not showing any item. it opens only empty Choose from list. what is the prblm
    Mathi

    The problem is that when this event is called again, the Conditions object still has the conditions from the last call :
    oConditions = oCFL.GetConditions();  // this has all the previous set conditions
    So the conditions set before are also taken into consideration. What you need to do is :
    oCFL.SetConditions(null);
    oConditions = oCFL.GetConditions();
    This way the Conditions object will be empty. There is no method to remove a Condition from a Conditions collection, so you have to make it null.

  • Associating a Custome ResultSet with a Choose From List

    Hi Experts,
    I have to Link the Chose from List with a UDO for accessing the records from the Parent Table /Child Table
    How to crack this problem?
    Also I have to associate the Results of a custom query in a choose from list so that when I press TAB over a Text Box I get a Choose From List which displays the Results and I could select one of those rows.
    Plz Hint me for this Problem

    Hello,
    When you create CFL, just set your UDO type with oCFLCreationParams.ObjectType = "My_UDO", the collumn to be displayed in CFL has been determined by Find Service in your UDO definition.
    As per custom query, actually you can set the condition to do so. Direct customed SQL is not supported in CFL. You may refer to the SDK sample for further info after you install SDK component:
    <<C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\17.ChooseFromList>>
    Private Sub AddChooseFromList()
            Try
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                'Just Set your UDO type.
                oCFLCreationParams.ObjectType = "My_UDO"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
                ' Adding Conditions to CFL1
                oCons = oCFL.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCFL.SetConditions(oCons)
            Catch
                MsgBox(Err.Description)
            End Try
        End Sub
    Kind Regards
    -Yatsea

  • UDO-Choose From List

    Hi;
    I would appreciate if someone could tell me how to associate an UDO to a choose from list.
    I have looked over the SDK example, but this is for standar SAP objects and I need to associate the choose from list to a customer object. 
    Best regards

    The choose from list (CFL) can be triggered from your edittext - there is some sample code in the DI API help file that shows this.  Have a look for 'Adding a choose from list object' in the help file.  Remember that where they set ObjectType="2", you should use the name of your UDO.
    As can also be seen in the help file, CFL objects allow you to add conditions to determine what rows are displayed.  In the example it shows selecting only where CardType = 'C'.  The columns displayed can be tailored by the user at runtime, where they can select from any columns that are on your main UDO table.
    There are a few limitations.  At present CFL's do not allow you to directly specify a SQL query.  Only data from the single table related to the 'ObjectType' is displayed.  If you want a more complex query that displays data from multiple tables when you press tab, a formatted search may be more powerful.  If you search the forums you should find one of my previous posts (probably about a year ago) where I showed how to link a formatted search to the tab keypress and have it behave in a very similar manner to a CFL.
    John.

  • Choose from list in Matrix

    Hey All,
    Has anyone been able to get the choose from list in a matrix text field working in SBO 2005 patch level 6? We have tried the tech demo and it works for new rows but not for existing rows. Also we have written our own code to set the matrix text box on the choose from list event and we get a general failure exception even though the value still gets set properly.
    If anyone has this working please post so we can all know how to do this properly.

    Hi there,
    This "Choose from list" thing is new for me, there's a Choose from List example in the new techDemo but i don't understand the code.. too complicated for me.. Is there any simple code/sample for this?
    Well i manage to trigger the choose from list .. but don't know how to put the selected value to the cell..
    Bruce..

  • Choose From List From a UDT in SAP Business One 2005 A

    Hi All
    How to develop a Choose From List from a <b>User Defined Table</b> (not from System Tables) in SAP Business One 2005 A.
    I need the Choose From List should display the records stored in the UDT.
    Any Idea ?
    Thanks in Advance.
    Regards.
    Asutosh.

    Hi Asutosh,
    You can add a CFL to a User Defined Object, not a simple User Defined Table.
    In order to do it you only have to set the object type of the CFL to the code of your UDO.
    Here you have a simple:
    oCFLCPuo = SB1_App.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
    oCFLCPuo.ObjectType = "MY_UDO_CODE"
    oCFLCPuo.UniqueID = "UserObjectCFL"
    oCFLuo = oForm.ChooseFromLists.Add(oCFLCPuo)
    Hope it helps
    Trinidad.

  • Change data in existing "Choose from list" matrix

    Hi,
      in UI GUI->order form . When add a new order, hit "TAB" to select BP from existing list. I want to use my own sql to populate the BP list (currently the GUI defaults to return all customers).
    Is there a way? I mean if I just want to change data in the matrix and let B1 continue to make the "Choose from list" form (form "10001") with my own new customer list.  Set BubbleEvent = true will just re-read all cards after I query my result.
      any help is appriciated!

    Hello,
    I came across the same issue with the Items Choose from List on the Sales Order screen. It is possible to load your own Choose from List form and populate the matrix using recordset objects and userdatasources. The same logic could be applied to the BP Choose from List form. The following code displays the user form and matrix items - separate code is needed to handle the selection process on this form. There maybe a faster way of acheiving this using UDTs etc but it seems to work ok.
    'When user presses Tab key in Item No. column.
    If pVal.EventType = et_KEY_DOWN Then
    If pVal.ItemUID = "38" And pVal.ColUID = "1" And _
    pVal.Before_Action = True And pVal.CharPressed = vbKeyTab Then
    'Load new Choose from List form.
    'This is actually an exported and edited version of the SBO form.
    LoadFromXML sIIS_ITEMLIST_XML
    'Populate matrix with items returned from SQL query.
    'Use recordset, arrays, userdatasources.
    Set oRecordSet = oCmp.GetBusinessObject(BoRecordset)
    sSql = "Select OITM.ItemCode, OITM.ItemName, OITM.OnHand FROM OITM " & _
        "Where Upper(Left(OITM.ItemCode,2)) = 'B1'"
    oRecordSet.DoQuery sSql
    nRows = oRecordSet.RecordCount
    If nRows <> 0 Then
    'Array declarations.
    Dim ItemCode(), ItemName(), OnHand()
    ReDim ItemCode(nRows - 1)
    ReDim ItemName(nRows - 1)
    ReDim OnHand(nRows - 1)
    'Add userdatasources to form.
    oForm.DataSources.UserDataSources.Add "ItemCode", dt_LONG_TEXT, 20
    oForm.DataSources.UserDataSources.Add "ItemName", dt_LONG_TEXT, 100
    oForm.DataSources.UserDataSources.Add "OnHand", dt_LONG_NUMBER
    i = 0
    'Populate arrays from recordset.
    Do While oRecordSet.EOF <> True
        ItemCode(i) = oRecordSet.Fields.Item(0).Value
        ItemName(i) = oRecordSet.Fields.Item(1).Value
        OnHand(i) = oRecordSet.Fields.Item(2).Value
        oRecordSet.MoveNext
        i = i + 1
    Loop
    'Bind data fields to form items.
    Set oMatrix = oForm.Items.Item("7").Specific
    Set oColumn = oMatrix.Columns.Item("ItemCode")
    oColumn.DataBind.SetBound True, "", "ItemCode"
    Set oMatrix = oForm.Items.Item("7").Specific
    Set oColumn = oMatrix.Columns.Item("ItemName")
    oColumn.DataBind.SetBound True, "", "ItemName"
    Set oMatrix = oForm.Items.Item("7").Specific
    Set oColumn = oMatrix.Columns.Item("OnHand")
    oColumn.DataBind.SetBound True, "", "OnHand"
    'Get data from datasources.
    Dim oUItemCode As SAPbouiCOM.UserDataSource
    Dim oUItemName As SAPbouiCOM.UserDataSource
    Dim oUOnHand As SAPbouiCOM.UserDataSource
    Set oUItemCode = oForm.DataSources.UserDataSources.Item("ItemCode")
    Set oUItemName = oForm.DataSources.UserDataSources.Item("ItemName")
    Set oUOnHand = oForm.DataSources.UserDataSources.Item("OnHand")
    oMatrix.Clear
    'For each returned record in recordset then
    'add row to matrix and populate it from
    'userdatasource.
    For i = 1 To nRows
        oMatrix.AddRow
        oUItemCode.Value = ItemCode(i - 1)
        oUItemName.Value = ItemName(i - 1)
        oUOnHand.Value = OnHand(i - 1)
        oMatrix.SetLineData
    Next i
    End If
    'Show form. This also sets focus to edittext field.
    oForm.Visible = True
    'Don't display standard SBO item list form.
    BubbleEvent = False
    End If
    End If
    Regards,
    Andrew.

  • "Choose from list" / "giving up after" error

    I have the following included in my script:
    set whattodolist to {"Tag with iDentify", "Add to iTunes", "Cancel"}
    set my_choice to choose from list whattodolist with prompt ("MP4 Detected: " & this_text)
    It works as expected with the script. I'd like to add a way for the script to dismiss itself after a set interval if the user doesn't take any action. So, I tried this:
    set whattodolist to {"Tag with iDentify", "Add to iTunes", "Cancel"}
    set my_choice to choose from list whattodolist with prompt ("MP4 Detected: " & this_text) giving up after 30
    Note that I added the "giving up after..." to the end of the prompt. However, it won't compile. I get an error stating "Expected end of line, but found identifier". Any advice?

    The standard display dialog command actually supports three options, so you might be able to fit your near-term needs with that:
    display dialog "MP4 Detected. What would you like to do?" buttons {"Cancel", "Tag with iDentify", "Add to iTunes"} default button 3 giving up after 30
    Once you get past three choices your options are limited...

  • Removing a Choose From List

    Hi
    I have a matrix containing numerous columns, one of which is a combo type column and one which is an edit box column containing a choose from list linking to the Item Master.
    What I need to happen is if the user selects a particular option from the combo column then the edit box column cell associated with that row will no longer allow the user to use the choosefromlist function and will not validate the value entered with an item. So basically I need to temporarily remove the choosefromlist functionality from this particular cell.
    The way I though of doing this was simply using a SAPbouiCOM.EditBox in order to select the particular cell and then try to set the .ChooseFromListUID property to "", however this does not work.
    Is there any way that this can be done?
    Thanks a lot
    Steve
    Edited by: Steven Tryner on Jun 9, 2009 4:41 PM

    Yeah I tried implementing this method into my code however the problem I had was stopping the cell from being automatically being validated against an Item, as it does with a choosefromlist. So if the text entered into the cell is not an Item the user can't navigate to any other cell until a valid itemcode is entered.
    Is there any way around this?
    Thanks

  • Choose from List-CFL button is not visible

    Hi Experts,
    I am using SAP B1 8.8 PL 05 in ramp up. I have observed that in some of the clients PCs in Sales Order window I am not able to see the Choose from list button / CFL button for selecting Customer Or say Item.
    This happens only in some Client PCs, where as in other clients PCs it works fine.
    BR
    Samir Gandhi

    Hi Rashid,
    I did that. Now the indicator is displayed, but still I am not able to see the customer / item  list.
    BR
    Samir Gandhi

  • Create a filtered list based on the selection in another field? URGENT HELP NEEDED

    Hi,
    Hoping someone can help me with something I am working on. i am fairly new to creating forms in acrobat (know how to us the full range of very basic features) but I have now found myself needing some help.
    i am producing an order form, and I need to create a filtered dropdown list based on the value selected in another field.
    basically, when a user select the company chooses their Business Name from a dropdown list, I would like their deliver address to self populate. In some cases there may be a few options for the company delivery address so in these cases the second option would be a dropdown list of the options available for that company.
    i have attached a screenshot, it is the Fields "Business Name" and "delivery Address/Delivery Postcode" that i would like to be linked so that the option in Business Name filtered the options in delivery Address
    Hope someone out there has the time to help me with this, i am using Acrobat Pro DC
    many Thanks
    Lee

    This will require a complex, custom-made script. The basic functionality of populating another field based on a selection in a drop-down is not that complicated, but if you want it to also populate other drop-downs (and then presumably use them to populate other fields), it will require a more complex solutions.
    This tutorial is relevant for your question: https://acrobatusers.com/tutorials/change_another_field

  • How to filter Choose from list object rows?

    Hi everyone,
    I'd like to show Choose from list window using SBO 2005 PL07, Actually I want to show the Active Account of G/L Account, I set the CFL object to one column as following:
    oCFLCreationParams.ObjectType = SAPbouiCOM.BoLinkedObject.lf_GLAccounts
    oCFLCreationParams.UniqueID = "CFL"
    oCFL = oCFLs.Add(oCFLCreationParams)
    Who knows how to set Choose From list object only show Active Account and do not show Title Account.
    Thanks for your help!
    Kathy

    Hi kathy
    I have not tried it on the gl accounts. But basicaly you need to add conditions to filter it. The following is an example that you would of used for business partners but only customers.
      Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "2"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
                ' Adding Conditions to CFL1
                oCons = oCFL.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCFL.SetConditions(oCons)
                oCFLCreationParams.UniqueID = "CFL2"
                oCFL = oCFLs.Add(oCFLCreationParams)
    The above also compensates for the tab.
    Hope it helps

Maybe you are looking for