Access unmapped field value in data source method extension

Hi all,

I am extending executeQuery method which is present for a data source at the form level. After this query is executed the unmapped fields in the form are updated, I have a requirement wherein I need to get the value of these unmapped fields. Can someone please help me regarding how to access the field value in the method.

I basically want to access form unmapped real field value in x++ code

What do you mean by “unmapped fields”? Controls not bound to any field or method, which have their value set directly in code? If so, then you need to get references to those controls and call their accessor methods (text(), realValue() etc.).

For example:

FormRealControl myRealControl = element.MyControl;
myStringControl.realValue();

Hi, thanks for your reply, I am using this in the method for form data table but not getting any data, could you please help me:

     public void executeQuery()
    {
        next executeQuery();        

        FormDataSource formDataSource     = this;
        SalesTable     salesTable         = formDataSource.cursor();
        
        FormRealControl realControl;              

        realControl = element.control(element.controlId(formControlStr(MCRSalesOrderRecap, SalesTotal))) as FormRealControl;
        real test = realControl.realValue();

    }

First of all, let me simplify your code. Writing unnecessary code isn’t only slowing you down, but it makes your solution harder to maintain.

public void executeQuery()
{
	next executeQuery();        

	FormRealControl salesTotalControl = element.SalesTotal;              
	real test = salesTotalControl.realValue();
}

If realValue() return zero, then it means that SalesTotal currently contains zero.

By the way, I wouldn’t use a data source extension in this case. I would extend the form and used CoC on setContinuityImpactedControls().