Data not populating for my SSRS Report

The data is not populating in my SSRS report. Below is the DP class Code.
[SrsReportParameterAttribute(classStr(TPO_CreditLimitAdj_ContractClass))]
public class TPO_CreditLimitAdj_DPClass extends SrsReportDataProviderPreProcessTempDB
{
TPO_CreditLimitAdj_HeaderTable _headerTmp;
TPO_CreditLimitJournalAdj_LinesTable _lineTmp;

CredManCreditLimitAdjustmentType _creditLimitType;
TransDate _fromDate;
TransDate _toDate;
List _custAccount;

[SRSReportDataSetAttribute('TPO_CreditLimitAdj_HeaderTable')]
public TPO_CreditLimitAdj_HeaderTable getTPO_CreditLimitAdj_HeaderTable()
{
    select * from _headerTmp;
    return _headerTmp;
}

[SRSReportDataSetAttribute('TPO_CreditLimitJournalAdj_LinesTable')]
public TPO_CreditLimitJournalAdj_LinesTable getTPO_CreditLimitJournalAdj_LinesTable()
{
    select * from _lineTmp;
    return _lineTmp;
}

public void processreport()
{
    Query    query;
    ListIterator custListIterator;
    QueryRun queryRun;
    QueryBuildRange qbRange;
    QueryBuildDataSource qbds, qbds2;
    TPO_CreditLimitAdj_ContractClass contract;
    CustAccount custAccount;
    utcdatetime         tmpDate;
   
    


    contract = this.parmDataContract() as TPO_CreditLimitAdj_ContractClass;
    
    _custAccount = contract.parmCustAccount();
    _creditLimitType = contract.parmAdjustmentType();
    _fromDate = contract.parmFromDate();
    _toDate = contract.parmToDate();

    tmpDate = contract.parmToDate();
    str custAccountString = this.ListToStr(_custAccount,",");

    query = new Query();
    qbds = query.addDataSource(tableNum(CredManCreditLimitAdjTable));
    //// No additional ranges needed as there are no filters
    qbds2 = qbds.addDataSource(tableNum(CredManCreditLimitAdjTrans));
    qbds2.joinMode(JoinMode::InnerJoin);
    qbds2.relations(false);
    qbds2.addLink(fieldNum(CredManCreditLimitAdjTable, JournalId), fieldNum(CredManCreditLimitAdjTrans, JournalId));

    if (_custAccount)
    {
        // Handle case where CustAccount provided
       
        qbds.addRange(fieldNum(CredManCreditLimitAdjTrans, CustAccount)).value(custAccountString);
    }
    
    
    else if(!_toDate && _fromDate)
    {
        // Handle case where toDate not provided
        qbds.addRange(fieldNum(CredManCreditLimitAdjTable, PostedDate)).value(queryRange(_fromDate,DateTimeUtil::date(tmpDate)));
        //qbds.addRange(fieldNum(CredManCreditLimitAdjTrans, CustAccount)).value(custAccountString);
    }
    else if(!_fromDate && _toDate)
    {
        // Handle case where fromDate not provided
        qbds.addRange(fieldNum(CredManCreditLimitAdjTable, PostedDate)).value(queryRange(dateNull(), _toDate));
    }
    else if(_fromDate && _toDate)
    {
        qbds.addRange(fieldNum(CredManCreditLimitAdjTable, PostedDate)).value(queryRange(_fromDate, _toDate));
    }
    
    
    queryRun = new QueryRun(query);
    ttsbegin;
    while (queryRun.next())
    {
        _headerTmp.clear();
        CredManCreditLimitAdjTable credManAdjTable = queryRun.get(tableNum(CredManCreditLimitAdjTable));
        CredManCreditLimitAdjTrans credManAdjTrans = queryRun.get(tableNum(CredManCreditLimitAdjTrans));
        CustTable custTable = queryRun.get(tableNum(custTable));
        _headerTmp.JournalId = credManAdjTrans.JournalId;
        _headerTmp.AdjustmentType = credManAdjTable.AdjustmentType;
        _headerTmp.FromDate = credManAdjTable.PostedDate;
        _headerTmp.ToDate = credManAdjTable.PostedDate;
        _headerTmp.CustAccount = credManAdjTrans.CustAccount;
        _headerTmp.insert();

        _lineTmp.clear();
        _lineTmp.CustAccount = credManAdjTrans.CustAccount;
        _lineTmp.Currency = custTable.Currency;
        _lineTmp.CustName = custTable.name();
        _lineTmp.CreditMaxNew = credManAdjTrans.CreditMaxNew;
        _lineTmp.insert();

    }
    ttscommit;
}

public str ListToStr(List _list, str _delimiter)
{
    ListIterator    listIterator = new ListIterator(_list);
    str             result;

    while (listIterator.more())
    {
        result += listIterator.value();

        listIterator.next();

        if (listIterator.more())
        {
            result += _delimiter;
        }
    }

    return result;
}

}

First of all, I don’t believe your code can even compile. Your listToStr() method expects a List object, but you’re passing a string there, which is completely wrong. Compiling code is necessary to be able to run it, therefore there is no point in trying to execute it until you fix compilation errors and successfully build the code.

When you’re able to run your code and the report is still empty, use the debugger to verify that your RDP class inserts any data at all. If not, continue debugging to isolate the problem and identify the reason.

If you find that your RDP class works flawlessly, you probably have a problem in the report and not in this class.

1 Like

This is the updated code, it is built with no errors. But when I debugged this Code in the inserting data to temporary tables it showed no data selected in both header and line table.

[SrsReportParameterAttribute(classStr(TPO_CreditLimitAdj_ContractClass))]
public class TPO_CreditLimitAdj_DPClass extends SrsReportDataProviderPreProcessTempDB
{
TPO_CreditLimitAdj_HeaderTable _headerTmp;
TPO_CreditLimitJournalAdj_LinesTable _lineTmp;

CredManCreditLimitAdjustmentType _creditLimitType;
TransDate _fromDate;
TransDate _toDate;
List _custAccount;




[SRSReportDataSetAttribute('TPO_CreditLimitAdj_HeaderTable')]
public TPO_CreditLimitAdj_HeaderTable getTPO_CreditLimitAdj_HeaderTable()
{
    select * from _headerTmp;
    return _headerTmp;
}

[SRSReportDataSetAttribute('TPO_CreditLimitJournalAdj_LinesTable')]
public TPO_CreditLimitJournalAdj_LinesTable getTPO_CreditLimitJournalAdj_LinesTable()
{
    select * from _lineTmp;
    return _lineTmp;
}

public void processreport()
{
    Query    query;
    ListIterator custListIterator;
    QueryRun queryRun;
    QueryBuildRange qbRange;
    QueryBuildDataSource qbds, qbds2;
    TPO_CreditLimitAdj_ContractClass contract;
   
     


    contract = this.parmDataContract() as TPO_CreditLimitAdj_ContractClass;
    
    _custAccount = contract.parmCustAccount();
    _creditLimitType = contract.parmAdjustmentType();
    _fromDate = contract.parmFromDate();
    if(!_fromDate)
        _fromDate = dateNull();
    _toDate = contract.parmToDate();
    if(!_toDate)
        _toDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());
    //custListIterator = new ListIterator(contract.parmCustAccount());
   
    str custAccountString = this.ListToStr(_custAccount,",");

    ttsbegin;
    _headerTmp.clear();
    _headerTmp.FromDate = contract.parmFromDate();
    _headerTmp.ToDate = contract.parmToDate();
    _headerTmp.AdjustmentType = contract.parmAdjustmentType();
    _headerTmp.insert();
    ttscommit;


    query = new Query();
    qbds = query.addDataSource(tableNum(CredManCreditLimitAdjTable));
    qbds.addRange(fieldNum(CredManCreditLimitAdjTable, PostedDate)).value(queryRange(_fromDate, _toDate));
    //qbds.addRange(fieldNum(CredManCreditLimitAdjTable, AdjustmentType)).value(_creditLimitType); 
    qbds2 = qbds.addDataSource(tableNum(CredManCreditLimitAdjTrans));
    qbds2.joinMode(JoinMode::InnerJoin);
    qbds2.relations(false);
    qbds2.addLink(fieldNum(CredManCreditLimitAdjTable, JournalId), fieldNum(CredManCreditLimitAdjTrans, JournalId));
    if (custAccountString)
    {
        // Handle case where CustAccount provided
        qbds.addRange(fieldNum(CredManCreditLimitAdjTrans, CustAccount)).value(custAccountString);
    }
    qbds2.fetchMode(QueryFetchMode::One2One);


    
    
    queryRun = new QueryRun(query);
    ttsbegin;
    while (queryRun.next())
    {
        _lineTmp.clear();
        CredManCreditLimitAdjTable credManAdjTable = queryRun.get(tableNum(CredManCreditLimitAdjTable));
        CredManCreditLimitAdjTrans credManAdjTrans  = queryRun.get(tableNum(CredManCreditLimitAdjTrans));
        _lineTmp.CustAccount = credManAdjTrans.CustAccount;
        _lineTmp.Currency = "GNF";
        _lineTmp.CustName = CustTable::find(_lineTmp.CustAccount).name();
        _lineTmp.CreditMaxNew = credManAdjTrans.CreditMaxNew;
        _lineTmp.PostedDate = credManAdjTable.PostedDate;
        _lineTmp.insert();

    }
    ttscommit;
}

public str ListToStr(List _list, str _delimiter)
{
    ListIterator    listIterator = new ListIterator(_list);
    str             result;

    while (listIterator.more())
    {
        result += listIterator.value();

        listIterator.next();

        if (listIterator.more())
        {
            result += _delimiter;
        }
    }

    return result;
}

}

It’s good that you fixed the bug and now your code compiles at least. Just note that converting the list of customers to a single comma-separated string isn’t an ideal approach: the following code is more robust and simpler than yours:

ListEnumerator custEnumerator = contract.parmCustAccount().getEnumerator();
while (custEnumerator.moveNext())
{
    qbds.addRange(fieldNum(CredManCreditLimitAdjTrans, CustAccount)).value(queryValue(custEnumerator.current()));
}

That the debugger shows that no value was loaded from database is completely correct; it’s not an indication of a problem.

By the way, you should learn a bit about conventions for X++ code. For example, only method parameters should be prefixed with underscore; using this prefix for local variables and class fields is a mistake that makes your code harder to understand.

1 Like

Even If a changed the lis2str method to this, The report is not population any data for the line table
Also thank you for bringing the conventions of X++ to my notice

You don’t need it at all. If there is no value, the body of the while loop won’t ever be executed and therefore no range will be added.

It’s one of things where your own solution is more complicated than necessary.

1 Like

Even If I changed it to this and builded and deployed my report, there are no records populating

As already mentioned, maybe your RDP class is correct and all data is prepared correctly, but you have a bug in the report that prevents the data from being shown.

Also, I see you’re using SrsReportDataProviderPreProcessTempDB, therefore your tables must be TempDB temporary tables. Verify that it’s the case.

1 Like

when I debugged the datas were not loaded into the line temporary table, It showed no data selected/Null.
Yes my temporary tables type is TempDB.So what would be the mistake in this code or anything else which I need to check. Also I have only created the Test Cases for the main table

Okay, let me explain it once more.

The debugger tells you that data of the buffer was loaded from database. And that’s true - you didn’t read any data from database. You created a new buffer, populated some fields and called insert(); you didn’t load anything from database. You may have a thousand records in database, but this variable doesn’t have this information. Therefore it’s irrelevant for your debugging.

If you want double-check that there is a data, use a while select statement (e.g.while select _headerTmp).

so how do I populate the data to my temporary table?

You already have code for it and I even mentioned in the reply you’re reacting to (populate some fields and insert()). The topic was different: that you didn’t know how to see data inserted to table.

1 Like

basically there are no records showing in the report, I don’t know where it is going wrong

You said that you verified that insert() was successfully called (for at least one record of at least one of the tables), therefore I assume that a record exists. You can verify it (and told you how). So it seems more likely that your current problem is in the report and not in the code.

You told us nothing about nothing about the report, therefore we have no chance to identify the problem.

But I teach you some debugging techniques.

A good idea is trying a simple report design. For example, you can create a new design (for debugging purposes only) where you’ll have just a matrix of TPO_CreditLimitAdj_HeaderTable records (after you verified that a record was inserted for this table). No filters, no grouping etc. If it works and your other design doesn’t, it’s a proof that you have a bug in the other design. Analyze and test whatever you have there.

Another possible technique is using regular tables with hard-coded data in your RDP class. Then you’ll be sure that the RDP class returns data, and if the report displays none, the problem must be somewhere in the report.

1 Like

using regular tables with hard-coded data in your RDP class, I tried this technique and checked in SSMS It isn’t showing any data.

I’m not sure what you need from us. The problem sounds quite clear: you tried to insert data to the table but you failed. Review your approach and try it again. If you use code to insert the data and it doesn’t work, use the debugger to identify the problem. Note that you can use a form as well.

what is wrong with the code, I want to join two tables i.e CredManCreditLimitAdjTable and
CredManCreditLimitAdjTrans and populate custAccount,Posted Date and Credit Limit Max new fields

I’m not an oracle; I can’t just guess what’s wrong in some unknown code. Use the debugger to find where you code doesn’t behave as expected.

1 Like

I did use the debugger for few lines the breakpoints are not hitting completely like its not getting completely highlighted.

Make sure you’ve compiled your code and put the breakpoint to code that is executed. A possible problem is that you expect the method to be executed, but it’s not, which would explain why it doesn’t do the job.