Population of combobox in a table-record

Population of combobox in a table-record

  

Hello all,

We have the requirement to populate combo box in a table-record based on an ID in the same row. Please see the screen shot attached.

i.e. each row element will have an ID coming from DB table (table 1), and based on this ID another table (table 2) is grabbed and populated in the combo box.

Finally, upon submit, all these selections from the different combo boxes must be stored in a third DB table (table 3).

We have tried many solutions without success, can you please guide us, how this can be done in outsystems?

Regards




Hi Dana,

Have you tried using the Editable Table widget? It seems to be exactly what you're looking for.

Solution

Hi Dana,

One solution:

  • The elements of your Table 1 should have another attribute that is the value of the combobox
  • Insert combobox in a Web Block
  • The Web Block will accept an input parameter which is the ID
  • In the Preparation of the Web Block set the list that will populate the combobox based on the input parameter
  • In the combobox set it's NoChange property to a new Screen Action
  • In the Screen Action call the Notify Action with the Id that comes from the dropdown as the value in the input parameter of the Notify
  • In the Instance of the Web Block (in your Screen) set the OnNotify property to be a new Screen Action
  • In that Screen Action call the NotifyGetMessage Action to get the Id from the combobox and assign that Id to the attribute that you created in your Table 1 (some datatype conversion will be needed).
  • When you submit, you go through all the elements of the table to build Table 3.

Let me know if I was not clear enough.

Cheers,

José

Solution

Thank you very much Jose Costa.

Hi Dana,

One solution:

  • The elements of your Table 1 should have another attribute that is the value of the combobox
  • Insert combobox in a Web Block
  • The Web Block will accept an input parameter which is the ID
  • In the Preparation of the Web Block set the list that will populate the combobox based on the input parameter
  • In the combobox set it's NoChange property to a new Screen Action
  • In the Screen Action call the Notify Action with the Id that comes from the dropdown as the value in the input parameter of the Notify
  • In the Instance of the Web Block (in your Screen) set the OnNotify property to be a new Screen Action
  • In that Screen Action call the NotifyGetMessage Action to get the Id from the combobox and assign that Id to the attribute that you created in your Table 1 (some datatype conversion will be needed).
  • When you submit, you go through all the elements of the table to build Table 3.

Let me know if I was not clear enough.

Cheers,

José



Another solution would be to populate the combo box with a function with input parameter category and returns a list of subcategory.

regards,

IB 

IBox  can you elaborate a little more on your solution ?

hi Alberto, I try:

Given: 

- Table1 (School)

- Table2 (SubCategory)


FInd:


Cookbook:

1. Create a Table Record with source Table1.School

where SubCategory is a ComboBox populated from records Table2. SubCategory, corresponds with the category in Table2.School

2.  Create a function getCategoryList that returns a list of the subcategories, given a category

where:

3. Assign the source of the combo to that function


4. On Submit, just iterate the Tablerecords and save to Table3:

where:


regards,

IB

Thanks IBox, for that detailed and clear explanation. Thanks