This topic is locked

Hiding previously selected value in Lookup Wizard

2/10/2020 11:46:37 AM
PHPRunner General questions
A
abhijit2020 author

Hi All!
I am hoping someone would be able to help me or give me a direction to how to approach on the below function.
I am trying to hide the previously selected list value in a lookup wizard column for the inline add rows in a list page. For example:
List page has the following columns:
EmpNo----EmpName----EmpType
EmpNo has a dropdown list (List Values: 10001, 10002, 10003, 10004, 10005, etc.), configured through a lookup wizard based on another table. EmpName is populated based on the selected value of a EmpNo. I was able to complete the EmpName population.
Inline add (1st row): User selected a value 10002

Inline add (2nd row): User would be able to select from the remaining values (i.e. excluding 10002). I would like to hide the value 10002. Now, it is showing all the values including the selected 10002.
So on...
Inline add (nth row): Display message there is no more value(i.e. EmpNo) to select or hide the "Inline Add" button so that user cannot add another row.
Much appreciated for helping me on the above request.
Thank you,
Abhi

Sergey Kornilov admin 2/10/2020

This can be done but will require extensive coding. You will need to load the initial list of options into a Javascript array. Then you need to implement field "change" event for those dropdowns. In that event you need to go through all dropdowns on the page and remove repeating options.

A
abhijit2020 author 2/11/2020



This can be done but will require extensive coding. You will need to load the initial list of options into a Javascript array. Then you need to implement field "change" event for those dropdowns. In that event you need to go through all dropdowns on the page and remove repeating options.


Hi Sergey,
Thank you for the suggestion to build the solution.
Abhi

A
acpan 2/11/2020

If i understand your question correctly, you want to:
Show the drop down list of a lookup table, excluding values already used in a grid during Inline Add.
Here's what i did earlier using just the WHERE condition in the lookup Wizard, to filter off the used values on the grid.
This is done using MySQL's GROUP_CONCAT to form a csv of the previously used values and use NOT FIND_IN_LIST to form the condition filter.
Refer to the tip here show a drop down list excluding used values in a grid during add and edit
ACP

Sergey Kornilov admin 2/11/2020

@ACP,
I'm afraid your suggestion is not going to work here. They are talking records currently being open in inline Add/Edit mode meaning that data is not in the database yet and SQL query won't help.

A
abhijit2020 author 2/11/2020



If i understand your question correctly, you want to:
Show the drop down list of a lookup table, excluding values already used in a grid during Inline Add.
Here's what i did earlier using just the WHERE condition in the lookup Wizard, to filter off the used values on the grid.
This is done using MySQL's GROUP_CONCAT to form a csv of the previously used values and use NOT FIND_IN_LIST to form the condition filter.
Refer to the tip here show a drop down list excluding used values in a grid during add and edit
ACP


Hi ACP,
Thank you for sharing the code. I am actually looking for this functionality when I select multiple rows without saving into the table which you have mentioned as a limitation. In my design, the lookup table does not display records that are already selected and saved into the table. I guess I have to figure it out how to implement the solution that Sergey suggested in his post.
Thanks,
Abhi