Hi everyone,
I'm not sure anyone has asked this question or not. I've tried to search but still not found the solution.
I created a report by used Bin to be DataItem then I set "Location Code" and "Code" to be ReqFilterFields. while I running the report in request page the field Code does not show drop-down list (please see the image below).
How can I do to display drop-down list to Code field?
Thank you.
Answers
you need to add a new Code Variable, which you place on the Request Page.
Then on the Request Page you have to set the Table Relation, which should point to Bin table.
After that you have to use that Code Variable on PreDataItem trigger in order to filter the Bin table.
Hope this helps.
Thomas Barbut
Hi thomas_barbut, thank you for your suggestion but the variable cannot support in case of user would like to choose multiple values such as A|B or A..Z
I noticed that the table that have one key can display drop-down list such as Item, Vendor, Customer, ect. but the table that contains more than one key like Bin, Product Group , ect. They cannot display the drop-down list on the second key. What did I do wrong? Is it possible?
Thanks
If you want to be able to specify a proper filter, rather than a single code value, you should add an arbitrary length text variable to your request page, rather than a code variable.
To validate the filter, I tend to set it on a record field of my choice, Then retrieve that filter again and set the variable to the retrieved filter value. As an alternative, or additionally, you might want to use functions from Codeunit 41 TextManagement for this.
For a lookup you need to code your own OnLookup trigger, calling the lookup page for the field you want to filter on. Then use the page function GetSelectionFilter, which is available for some (e.g. Page 22 Customer List) but needs to be added for others. These functions usually use functions in Codeunit 46 SelectionFilterManagement. I believe, though, that these functions will not properly work for primary keys consisting of more than one field. So you would need to create your own.
I did not verify this, but likely you could also alter the table, modifying the properties of the field. Specify the table relation, specifying table and field, and set ValidateTableRelation and TestTableRelation to No. Then, on pages where you can create new records, you might want to disable the lookup on that field again.
vaprog has a good point. I would certainly give it a try.
Thomas Barbut
Thanks.