How to create seperate selector for composite primary key...
Like OrderNbr and Revision nbr ...
I am facing issue in selecting the value from Order Nbr selector, it set the values if revision nbr field is default value otherwise Order nbr selector cant set the values in Revision nbr field..
how to set both the fields on selecting the value from any of the selector.
The solution is to have one selector query reference the other key field.
Example for Sales Order which uses two selector control OrderType and OrderNumber:
// User selects the OrderType first
[PXSelector(typeof(Search<SOOrderType.orderType>))]
// OrderNumber Selector reference current OrderType value in selector query
[PXSelector(typeof(Search<SOOrder.orderNbr,
Where<SOOrder.orderType, Equal<Current<this.orderType>>>>)]
You also need to set the AutoRefresh property to True so the selector re-execute the query each time the selector dialog is re-opened. This ensure that it is properly filtered by order type in the example.
<px:PXSelector ID="edOrderType" runat="server" DataField="OrderType"
AutoRefresh="True" CommitChanges="True" DataSourceID="ds">
<px:PXSelector ID="edOrderNbr" runat="server" DataField="OrderNbr"
AutoRefresh="True" CommitChanges="True" DataSourceID="ds">
It is strictly not possible to have a single selector dialog select a record which requires more than one field to be unique. In those special cases, an alternative solution is to add another field which is unique and to select the record based on that field. Note that for your use case two selector controls is
preferable.
To implement this alternative solution add an Identity type column in database as the unique field and decorate the matching DAC field with PXDBIdentity attribute. Keep the other keys as is. The identity field will auto-increment automatically and guarantee the uniqueness based on a single field which is required for the selector to function properly.
Related
I'm adding a user field to the Order Types screen, which is an int32. I want the same lookup as the subaccount field on the Sales order screen (field name: SalesSubID). Here's what the attributes look like on that field, based on the source DAC:
[PXFormula(typeof(Default<SOLine.branchID>))]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[SubAccount(typeof(SOLine.salesAcctID), typeof(SOLine.branchID), Visible = false)]
I've tried using these attributes on my user field, but it doesn't work at all. Unfortunately, as all too often happens in Acumatica, HOW this is implementing a segmented F3 lookup is a total black box / mystery, not covered in any training (not to mention how this field even shows up when visible is set to 'false' is a puzzle...).
So - the question is: How can I implement a segmented subaccount lookup on an int32 user field to replicate what the subaccount field is doing on the Sales Order grid?
I don't see any mention of the page so I am guessing you need to make your field in the page a PXSegmentMask
A snip of SalesSubID as defined on sales order page SO301000
<px:PXSegmentMask ID="edSalesSubID" runat="server" DataField="SalesSubID" AutoRefresh="True" />
Otherwise your DAC attributes look good.
In the stock item screen, a custom grid is added. The DAC for the custom grid contains InventoryItem.inventoryID. That particular grid has a custom field in which the user wishes to search for, inside the inventory item selector control. I refer to the primary Inventory Item selector control for the stock item screen.
In normal circumstances, the customization manager allows you to select a particular field, and add that to the grid which appears inside the selector control. That is simple, since the field is a member of the same DAC. But in my case, I wish to add a column from the related data view. Since the primary data view has no knowledge of grid, the needed column is not available for selection. Also there is a high probability that records will be repeated inside the selector control, since the relation is one to many. This is acceptable.
I try the following suggestions.
1) use Cache_attached event handler, for InventoryItem.InventoryCD.
I add my own custom PXSelect statement which joins InventoryItem & CustomTable. But an error occurs: A foreign key reference cannot be created from the type 'PX.Data.PXSelectJoin`3[PX.Objects.IN.InventoryItem (ect)
2) Declare data view delegate for Items which yields type InventoryItem & CustomDAC. This approach returns no errors. However I am unable to select the user field, in the field selection panel.
3) Create a Project on InventoryItem DAC and write a PXSelect to join the two tables. I am unsure if this is the correct approach.
I wish to know if anyone has suggestions
You should follow the approach suggested here to concatenate field values from a related data view into a custom text column inside the InventoryItem table.
I have two tables: one is a header table, the second its details table. I want to implement a grid containing two selectors. The user will select a header value from the first selector which will cause the second selector to update with the related detail values. What do I need to do to get the second one to update with the proper detail values based on the first selector's selected value?
You just need to set the selector to use Current and point to the Dac/Field used in your header the same way you do a view in a graph.
[PXSelector(typeof(Search<TableTwo.someOtherField,
Where<TableTwo.someRelatedField, Equal<Current<HeaderTable.relatedField>>>))]
In your page file on your grid field, you need AutoRefresh set to true.
<px:PXSelector ID="edAField" runat="server" DataField="AField" AutoRefresh="True" />
If nothing is showing in your selector, make sure the header value is committed before trying to select the value on the grid field.
We have a custom table and use a selector on the key field of this table on various pages. In the selector we need the ability to also search on other fields so we set the page entry for PXSelector to include FastFilterFields as shown in this example:
<px:PXSelector ID="edMyCustomField" runat="server" AutoRefresh="True"
DataField="MyCustomField" DataSourceID="ds" CommitChanges="True">
<GridProperties FastFilterFields="InventoryID,InventoryItem__Descr">
<Layout ColumnsMenu="False" />
</GridProperties>
</px:PXSelector>
This works great on our pages. In the example above, entries into the selector search box will return rows with matching values from the MyCustomField, Inventory ID, InventoryItem.Descr fields.
Now the issue/question…
We want the same search/FastFilterFields functionality for our reports on our report parameter selectors. Currently the selector only allows the search on the field tied to the selector (one searchable field).
How do we enable our report selectors to use additional searchable fields the same as our custom pages?
From what I have found it is not possible for searching beyond the standard 2 fields in a selector used on a report. By default the only searchable fields are the field being selected and the description field defined as the description field in the select attribute.
Scenario: I have a DAC called Table1. That DAC has a key field, and that key field has a selector with a condition. Let's say,
[PXSelector(typeof(Search<Table.keyField, Where<Table.fieldCheck, IsNull>>))]
So, on the page, the Selector works just fine; I get all keyFields from Table where fieldCheck is null. But, when I click the navigation buttons, they completely ignore the "fieldCheck is null" condition and loads those records anyways. How can I bind my navigation buttons to the conditions laid out in the selector?
Unless I am missing some other condition of your page, you should be able to use a filter object on your primaryview, or just limit your primary view by the same condition that you have in your Selector, you would then only retrieve the records desired.