Notifications
Announcements
No record found.
Hey! How should I write the code on the modifiedField method on the table so that a check box is unchecked when another is checked?
The name of the field is DefaultValue (checkbox) and it is an Enum of type NoYes and the table is PI_MarketingCategory
Hi Pavel,
You can try something like this:
if(PI_MarketingCategory.DefaultValue == NoYes::Yes){ PI_MarketingCategory.xxx == NoYes::No }
This doesn't work for me. When I check a checkbox in the DefaultValue field, the others must be unchecked. In the end, I must be able to have only one checked value per column. It is about the same field and not about different fields.
Being the method on the table, shouldn't I use "this"?
In the end it should look like this
Hello ,
You would have to update other record(s).
PI_MarketingCategory PI_MarketingCategory; ttsbeggin; if(this.DefaultValue == NoYes::Yes) { while select forupdate PI_MarketingCategory where PI_MarketingCategory.DefaultValue = NoYes::Yes { PI_MarketingCategory.DefaultValue =NoYes::No; PI_MarketingCategory.update(); } } ttscommit;
This solution allows me to check only one default value, but it does not automatically uncheck the box when I set another value.
On which part of the form did you insert this code ?
I have to override the modifiedField method on the table
Hello Pavel,
Kindly use this on the modifiedField method of the table.
// Table public void modifiedField(FieldId _fieldId) { kwstABLE kwstABLE; super(_fieldId); switch(_fieldId) { case fieldNum(kwstABLE,defaultValue): ttsBegin; while select forupdate kwstABLE where kwstABLE.MarketingCategory != this.MarketingCategory { kwstABLE.DefaultValue =NoYes::No; kwstABLE.update(); } ttsCommit; } }
This does the actual work. After you would need to refresh the form with this.
Kindly overide the modieldField method on the form for your DefaultValue field.
/// DefaultValue field on the form public boolean modified() { boolean ret; ret = super(); kwstABLE_ds.refresh(); kwstABLE_ds.research(true); return ret; }
I tested this and it worked. If you have any challenge please do let me know.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 551 Most Valuable Professional
André Arnaud de Cal... 450 Super User 2025 Season 2
BillurSamdancioglu 278 Most Valuable Professional