Use variables on Query API

Is it possible to create a query outputting Sales Invoice Lines, but include Currency Factor from the Sales Invoice Header.

The triggy part, is that i want to replace currency factory with 1, if the currency factor is 0.

Tried to use the “OnbeforeOpen” trigger and variables, but i cant select the variable as a column.

Code:

query 50110 “PBI Sales Invoice Line”
{
APIGroup = ‘apiGroup’;
APIPublisher = ‘publisherName’;
APIVersion = ‘v1.0’;
EntityName = ‘entityName’;
EntitySetName = ‘entitySetName’;
QueryType = API;

elements
{
    dataitem(salesInvoiceLine; "Sales Invoice Line")
    {
        column(documentNo; "Document No.")
        {
        }
        column(amount; Amount)
        {
        }
        column(description; Description)
        {
        }
        column(description2; "Description 2")
        {
        }

    }
}

trigger OnBeforeOpen()
var
    salesInvHeader: Record "Sales Invoice Header";
    currencyFactor : Decimal;

begin
    if salesInvHeader.get(documentNo) then
        CurrencyFactor := salesInvHeader."Currency Factor";
    if currencyFactor = 0 then
        currencyFactor := 1;
end;

}

In a Query you cannot add variables as columns. This can only be done in API pages.