web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Argument 'value' is incompatible with the required type

(0) ShareShare
ReportReport
Posted on by 2,050

i'm trying to create RPD for my custom report by contract so i'v create this function

[SysEntryPointAttribute]
public void processReport()
{
    Query query;

    QueryRun qRun;

    QueryBuildRange qbr,qbr1,queryBuildRange;

    QueryBuildDataSource    queryBuildDataSource;

    PayrollPayStatementEarningLine  payrollPayStatementEarningLine;

    PayrollPayStatementLine         payrollPayStatementLine;

    PayrollPayStatement         payrollPayStatement;

     HcmWorker   hcmWorker;

    HcmPositionWorkerAssignment hcmPositionWorkerAssignment;

    HcmWorkerRecId hcmWorkerRecId;

    int64 Idforline,PeriodX;

    contract = this.parmDataContract() as PayStatmentRPDPContract;

    hcmWorkerRecId=contract.parmHcmWorkerRecId();


    PeriodX=contract.parmPayPeriod();

    select RecId from PayrollPayStatement
    where PayrollPayStatement.Worker==hcmWorkerRecId
    && PayrollPayStatement.PayPeriod==PeriodX;

    select PayStatement from payrollPayStatementEarningLine
    where payrollPayStatementEarningLine.PayStatement==PayrollPayStatement.RecId;

    Idforline=payrollPayStatementEarningLine.PayStatement;

    queryBuildDataSource = query.dataSourceTable(tablenum(payrollPayStatementEarningLine));

    if(Idforline)
    {
        queryBuildRange = queryBuildDataSource.findRange(fieldnum(payrollPayStatementEarningLine, PayStatement));
        if (!queryBuildRange)
            {
                queryBuildRange = queryBuildDataSource.addRange(fieldnum(payrollPayStatementEarningLine, PayStatement));
            }
        if(!queryBuildRange.value())
            {
                queryBuildRange.value(Idforline);
            }
    }

    qRun = new QueryRun(query);
    
     while(qRun.next())
     {
         payStatmentRPTemp.clear();
         payrollPayStatementEarningLine = qRun.get(tableNum(PayrollPayStatementEarningLine));

         payStatmentRPTemp.AccountingDate=payrollPayStatementEarningLine.AccountingDate;
         payStatmentRPTemp.EarningCode=payrollPayStatementEarningLine.EarningCode;
         payStatmentRPTemp.Quantity=payrollPayStatementEarningLine.Quantity;
         payStatmentRPTemp.EarningRate=payrollPayStatementEarningLine.EarningRate;
         payStatmentRPTemp.insert();

     }
}

but i got error here (i think type of parm or somthing)

problem-on-report.JPG

I have the same question (0)
  • Blue Wang Profile Picture
    on at
    RE: Argument 'value' is incompatible with the required type

    Hi  Mohammed,

    The parameter type of queryBuildRange.value () should be str, but you define Idforline as int64.

    Please check Q class.

    public str value([str value])

    docs.microsoft.com/.../q-classes

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Argument 'value' is incompatible with the required type

    the .value() method of QueryBuildRange always wants an argument that is of type string. You see this in the tooltip when you type "queryBuildRange.value(".

    The type of PayrollPayStatementEarningLine.PayStatement is int64.

    So you need to convert it to string: queryBuildRange.value(int642str(idForLine));

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 878 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 681 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 496 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans