The problem “IsRestricted” checkbox is never set to checked
Page 1 / 1
Hi @hotdok
We should avoid setting any values in the RowSelectedevent, as its primary purpose is to control the enabling, disabling, visibility, or invisibility of fields.
Could you clarify when exactly you need to check the "Is Restricted" checkbox as part of your functionality? Are you looking to have this checked by default, or is there a specific logic or condition you'd like to apply?
Hi @Naveen Boga
Thanks for reply. I just want to figure out how can I set checkbox as checked in gridview based on some complex bql request from several DACs.
@hotdok
You've defined an unbound field (i.e., not a database field). Please note that even if you set a value and refresh the screen, the value will be cleared.
If you want to set a value and have it persist in the database, you'll need to create a database field as shown below.
public class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine> {
PXDBBool] PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)] PXUIField(DisplayName = "Is Restricted")] public virtual bool? UsrIsRestrictedField { get; set; } public abstract class usrIsRestrictedField : PX.Data.BQL.BqlBool.Field<usrIsRestrictedField> { }
@Naveen Boga Thanks. Could you please suggest which event to use to update the field?
@hotdok Can you please let me know when exactly you wanted to set this value as TRUE?
Like After entering the Inventory ID, you wanted to check some condition and set the value as TRUE or while saving the Order?
I want to set it on page load at first. So once the exact sales order is open this calculation should happen. I do not want to save checkbox state in db.
@hotdok If you do not want to save the field value in the database then you can go ahead with Unbound field and you can set the default value as TRUE in the DAC itself like below.
Hope this code helps you.
public class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine> {
PXBool] // This is Unbound field PXDefault(true, PersistingCheck = PXPersistingCheck.Nothing)] // Setting the Default Value as TRUE PXUIField(DisplayName = "Is Restricted")] public virtual bool? UsrIsRestrictedField { get; set; } public abstract class usrIsRestrictedField : PX.Data.BQL.BqlBool.Field<usrIsRestrictedField> { }
}
no I want to set checbox state based on complex BQL query when screen is opened. So Im trying to understand what event to use for it. I tried to use [PXFormula] attribute for it but it works only with current DAC but I need selecting data from 2 DACs to determine if checkbox should be set or not. I wanted to populate checkbox in RowSelected event handler but it didnt work for me. Moreover it highly not recommended to do. I have BQL request like