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

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:Acumatica Dynamic MultiSelect Dropdown