GXqueryOutputFormat data type

Unofficial Content
Gxquery4 - GXqueryOutputFormat data type

The GXquery service layer, known as API, includes all the data types that allow the developer to interact with GXquery at runtime through script code. One of these data types is described below.

Queries can have more than one output format, and this data type is used to know what  they are and choose one before display.


Id Is the output format Id.
Title Is the output format Title.
IsDefault Is a boolean indicator to confirm if the current format is the default one.
ChartType Is the chart type. Has an empty value if the OutputType property has "PivotTable" value or "Table" value.
OutputType Store the output type of the query. There are three possible values: "Table", "PivotTable" or "Chart". If "Chart", the ChartType property store its type.



In this example, a Query contains many output formats for the end user, which can choose one. To solve this case, the developer wrote the script code, as below.

Event 'GetInformation'
    &GXqueryQuery = &GXquerySession.GetQueryByName(&QueryName, &Errors)
    If &Errors.Count > 0
        &Status = &Errors.Item(1).Message
        &GXqueryQueryInfo = &GXqueryQuery.GetInformation(&Errors)
        If &Errors.Count > 0
            &GetQueryInfoStatus = &Errors.Item(1).Message
            &GetQueryInfoStatus = "GetInformation successful"
            For &GXqueryOutputFormat in &GXqueryQueryInfo.OutputFormats
                &OutputFormatId.AddItem(&GXqueryOutputFormat.Id, Iif(&GXqueryOutputFormat.Title <> "", &GXqueryOutputFormat.Title, &GXqueryOutputFormat.id))
            For &GXqueryParameter in &GXqueryQueryInfo.Parameters
                &ParameterName.AddItem(&GXqueryParameter.Name, Iif(&GXqueryParameter.Description <> "", &GXqueryParameter.Description, &GXqueryParameter.Name))

The GetInformation was created for: if the query has more than one output format, give the user the posibility to choose one, too. So, to understand this, we will analyze some parts of the script code.

With the first statement we ask the name of the chosen query from the &QueryName combo box; after first Else, we execute the GetInformation method to obtain the name and other information, which is not relevant right now.

With the first For command, the dynamic combo box called &GXqueryOutputFormat, is loaded with the output format IDs.

With the second For command, the combo box called &GXqueryParameter, is loaded with the parameters list (if there are).

In this way, the combo box is ready for the end user to select one output format.