Adam Bergeron
Adam Bergeron

Reputation: 525

Limit Dropdown Options For Datasource Relationship

Short Version:

Need to limit the options (run a query) of a dropdown that is in a table with a relationship datasource. The field of the query exists in the OWNER datasource, while the field of the dropdown exists in the non-OWNER (child?)


Long Version:

I have a system setup to organize PO requests.

Model PORequest = holds PO numbers, etc.

Queried Datasource PORequest_HideArchived = holds all POs, but has the query:

Archived != :ArchivedStatus

Where the Archived status is set for 'Yes'. Therefore all POs with 'Yes' in the ArchivedStatus field are hidden.

Datasource PORequest_Items = holds the items for each PO request

I have setup a ONE to MANY relationship with PORequest as the owner.


So now I can generate a PORequest (left) and add items to that PO via a table (middle + right) with the datasource: PORequest_HideArchived:PORequest_Items (relation).

enter image description here

So far so good.

That table on the far right is where I am running into a problem. I want to be able to move a PO Item from one PO to another. The easiest way to do that is change the PORequestNumber field of the item (datasource = PORequest_HideArchived) that is linked via the relationship.

enter image description here

All this works great too.

Only problem is that when I click the dropdown for the PORequestNumber I can see ALL the PORequestNumber entries, instead of JUST the POs that aren't archived.

enter image description here

So instead of seeing 1-6, I should only be seeing the active POs (1, 5, 6)

The panel that the table is in has the datasource: PORequest_HideArchived:PORequest_Items (relation)

But the Row that the PORequestNumber field is in has the datasource: PORequest_Items.

Therefore my query on the PORequest_HideArchived datasource has no effect.

Any way I can run this query so the dropdown options are limited to ArchivedStatus = 'No'?

Upvotes: 0

Views: 352

Answers (1)

Pavel Shkleinik
Pavel Shkleinik

Reputation: 6347

You need to set filtered datasource for the dropdown options/names:

@datasources.PORequest_HideArchived.items

and for the dropdown select row's item relation:

@datatsource.item.PORequest

Upvotes: 1

Related Questions