75572

Acumatica Dynamic MultiSelect Dropdown

I have a screen entry to store transaction data, I want to use dynamic with <strong>multiselect combobox</strong> to select status and status data is taken from the <strong>table</strong>, but when some of the data status is selected, the amount of stored data does <strong>not match</strong> that has been selected,

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/qYfli.jpg" alt="Screen Entry Screenshoot">

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/ThxEq.jpg" alt="Database Screenshoot">

I have tried the following code, but it's doesn't work for me.

public class StatusMultiStringListAttribute : PXStringListAttribute { public StatusMultiStringListAttribute() : base() { PXResultset<StatusTable> rslt = PXSelect<StatusTable>.Select(new PXGraph()); List<string> values = new List<string>(); List<string> labels = new List<string>(); foreach (PXResult<StatusTable> item in rslt) { BSMTStatus e = (StatusTable)item; values.Add(e.StatusID); labels.Add(e.Description); } this._AllowedValues = values.ToArray(); this._AllowedLabels = labels.ToArray(); MultiSelect = true; } }

is there any other solution, sorry my English is bad, thanks.

Answer1:

I noticed your comment on http://asiablog.acumatica.com/2016/03/multiselect-combo-box.html and saw that you posted some additional code. Based on your sample code, I identified two problems:

First of all, the values you're loading from the StatusTable DAC contain trailing spaces which are not trimmed. You haven't provided the declaration of the StatusTable DAC, but it's safe to assume from your screenshot that this field has the IsFixed attribute set to true. With these settings, the system will add white space at the end of your value. To save space in the target field, I would recommend to add a Trim() to the constructor code:

foreach (PXResult<StatusTable> item in rslt) { BSMTStatus e = (StatusTable)item; values.Add(e.StatusID.Trim()); //Remove any white-space labels.Add(e.Description); }

Second, the status field where you're storing the selected values is not long enough to accommodate multiple selections. It's currently defined as 20 characters ([PXDBString(20, IsFixed=true)]), and even assuming you remove the whitespace you would still be limited to 4 choices. I suggest you to change it to 255, and to also remove IsFixed=true since it's not needed for this field:

[PXDBString(255)] [PXDefault] [PXUIField(DisplayName = "Status")] [StatusStringList] public virtual string Status

Recommend

  • error AR303000Submit use php - Api Acumatica ERP
  • How to customize the sales order process to trigger an automatic “adding contract” process when sale
  • Acumatica - Adding Image in Sales Order Line
  • Android java.lang.RuntimeException: illegal property: while getting the string from SOAP Object(KSOA
  • sub query in SELECT line
  • DropdownlistFor throws an error
  • How do I upload a file to an Acumatica Screen through HTTP virtual path?
  • How to automatically refresh the SO Order Entry Page
  • Add Excel upload control to grid toolbar
  • PyQt4 application on Windows is crashing on exit
  • Extract All Possible Paths from Expression-Tree and evaluate them to hold TRUE
  • Activation Function choice for Neural network
  • XSLT foreach repeating nodes to flat
  • SQL Query - Table Joining Problems
  • List images(01.png) and descriptions(01.txt) from directory
  • Conversion from string “a” to type 'Boolean' is not valid
  • Array with custom indexes in Ionic2
  • Grails calculated field in SQL
  • Sort List of Strings By Version
  • Set the selected item in dropdownlist in MVC3
  • D3 nodes and links from JSON with nested arrays of children
  • jQuery .attr() and value
  • Highlight one bar in a series in highcharts?
  • Getting last autonumber in access
  • Can Jackson SerializationFeature be overridden per field or class?
  • How to check if every primary key value is being referenced as foreign key in another table
  • MySQL WHERE-condition in procedure ignored
  • How to model a transition system with SPIN
  • Display Images one by one with next and previous functionality
  • ORA-29908: missing primary invocation for ancillary operator
  • How to get next/previous record number?
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How do you join a server to an Active Directory (domain)?
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • How does Linux kernel interrupt the application?
  • UserPrincipal.Current returns apppool on IIS
  • How to push additional view controllers onto NavigationController but keep the TabBar?