Cbb value.selected item cbb value.items 0 là gì năm 2024

Some of them are ComboBox and were filled with "Valid Values". The First Value is always (" ", " ").

The problem is that I can't select this value by SDK, I tried to do it ByKey, ByValue, ByIndex, and there was not a success result.

Does anyone knows how can i do this? Is there anyway to set an empty value, by default, to a field that was created by SDK?

Thank you.

  • SAP Managed Tags:
  • SAP Business One Extensibility

Hi,

Try this.Hope this will help you.


OCT_ComboBox1.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)

Regards,

Mahendra

HI

Is the control bound to a DataSource ? What I did was actually to use a hidden text box which holds the value selected by the user on the combo box. Hence I use something like this to assign the value back from the text box to the combo box ...


Dim oCombo As SAPbouiCOM.ComboBox = oForm.Items.Item("cbo").Specific
If Len(oForm.Items.Item("txt").Specific.Value) > 0 Then
    oCombo.Select(oForm.Items.Item("txt").Specific.Value, SAPbouiCOM.BoSearchKey.psk_ByValue)
Else
    oCombo.Select("", SAPbouiCOM.BoSearchKey.psk_ByValue)
End If

hope it helps

Hi Mahendra,

That's what i try to do, but the error is "Argument is out of range".

Hi David,

the problem is when the user select some value of this combo and then try to select then blank value again, that`s no possible!!

First, your question is not a usability question, so you should post questions like these in the Tech forum, where it'll get much more attention.

Secondly, I think you misunderstand the way combo boxes work with their Variable vs. their Special List. If you do not have a special list, it's straight forward: the combo box is populated with items from the list, so the Variable contains whatever is the first item's Identifier Value on start-up, unless the Variable has another value than its type's null value (NullIdentifier(), NullTextIdentifier(), 0, 0.0, "" or False depending on its type) and that value is in the list, in which case the default selected item is set to that.

If you add a Special List to the mix, you need to understand that whatever value from the Special List you select, your Variable is going to be set to its null value. That's why your variable is 0. This is good, because it signals your application that an item from the Special List is selected, as opposed to an item from the Source Record List. Keep in mind that most of the time, you'll populate a combo box with the output from a query, the Entity's Id being the Source Identifier Attribute, and your Variable being of type Entity Identifier. It would almost never make sense in such a scenario to want to assign the Value from the special list to the Variable.

But... of course, if your special list is more than a single item, you need to know which item has been selected. Enter the Special Variable. The Special Variable is a variable you specify to receive the Value of the selected Special List item. If the user selects an item from the Source Record List, it is set to its null value. Otherwise, it's filled with the Value of the selected Special List Item.

So, to wrap up, you didn't experience "strange behaviour", but quite normal, documented, behaviour of the Platform. To solve your problem, if you have a single item in the Special List, just test for 0 or NullIdentifier() (depending on your Variable's type) to see if the Special List Item is selected, if you have more than a single one, specify a Special Variable, and test its content when the Variable is null.

Is there a way to pre-select a value from a combo box-column (like pre-selecting value from a regular combo-box)

RGDS

Hagai

  • SAP Managed Tags:
  • SAP Business One Extensibility

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

  • Comment

Accepted Solutions (1)

Accepted Solutions (1)

Cbb value.selected item cbb value.items 0 là gì năm 2024

  • Mark as New
  • Bookmark
  • Subscribe
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

Dim oc As SAPbouiCOM.ComboBox

oc = oMAtrx.Columns.Item("1").Cells.Item(i).Specific

oc.Select(0, SAPbouiCOM.BoSearchKey.psk_ByValue)

(You can run through the lines in the matrix and set the values one by one)

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

  • Comment

Cbb value.selected item cbb value.items 0 là gì năm 2024

  • Mark as New
  • Bookmark
  • Subscribe
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

you will have to preselect it row by row.

It's like having many "normal" comboboxes on a form - if you want it selected - you have to select it.

Same applies to the matrix - each combobox field you want selected - must be physically selected...

The life of a programmer is a painful one...

Cbb value.selected item cbb value.items 0 là gì năm 2024

  • Mark as New
  • Bookmark
  • Subscribe
  • Subscribe to RSS Feed
  • Print
  • Report Inappropriate Content

ok.

I have a UDO form with a matrix.

when I load the form to the screen, I call a method named "x" for inserting valid values to column, thus each time I add row to the matrix, the column is being filled woth those values.

My problem is in the first row, when I press the "cntrl+a" in the screen, the first row is being created automatically and then I want to pre-select a specific value from the combo-box.