I'm trying to run several reports form a class extending runBaseReport.
This way I can use temptables (tmpAccountSum) as a datasource for all reports.
The report which have to be run depends on the itemid choosen by the user in a 
dialog.

The problem is no matter what I do lastValueElementName always ends up with the 
default: return reportstr(FIKPRDRRHDELUXE)????????

Code:

public identifiername lastValueElementName()
{
switch (ItemId)
 {
 case "MW-RHDDELUXE" :
   return reportstr(FIKPRDRHDDELUXE);
    break;
 case "MW-RRHDELUXE" :
   return reportstr(FIKPRDRRHDELUXE);
    break;
 case "MW-CLASSIC" :
   return reportstr(FIKPRDCLASSIC);
    break;
 case "MW-SOLIDE" :
    return reportstr(FIKPRDSOLIDE);
    break;
  case "MW-HOR24X12" :
   return reportstr(FIKPRHOR24X12);
    break;
 case "MW-IZ43X19":
    return reportstr(FIKPRDIZ43X19);
    break;
 case "MW-SCHUIFHOR" :
   return reportstr(FIKPRDSCHUIFHOR);
    break;
case "MW-VZHOR17X17" :
    return reportstr(FIKPRDVZ17X17);
    break;
default :
    return reportstr(FIKPRDRRHDELUXE);
 }
 }

public Object dialog(Object _dialog)
{
    DialogRunbase dlg = super(_dialog);

    //this.sendInfo(funcname());

    dlgItemId = dlg.addFieldValue(typeid(ItemId),itemId);

    return dlg;
}

/*
    This method is used to receive the values from the dialog.
    It is called if the user clicks OK in the dialog.
*/
public boolean getFromDialog()
{
    boolean ret;
;

    ret = super();

    if (ret)
    {
       // this.sendInfo(funcname());
        itemId = dlgItemId.value();
    }

    return true;
}

static void main(Args args)
{
    FIKPBARapportGenerator FIKPBARG;
;

    FIKPBARG = new FIKPBARapportGenerator();

    if (FIKPBARG.prompt())
        FIKPBARG.run();
}

It looks like ReportName in the next method is always set to the 
lastValueElementName's switch default:  return reportstr(FIKPRDRRHDELUXE)

In other words lastValueElementName is queried, itemid = empty because the 
dialog didn't fire yeet and makeReportRun uses the default / useless 
FIKPRDRRHDELUXE????

public void makeReportRun(ReportName reportName = this.lastValueElementName())
{
    Report          report;
;
    if (! reportRun || reportRun.name() != reportName)
    {
        if (sysArgs)
        {
            sysArgs.name(reportName);
        }
        else
        {
            sysArgs = new SysArgs(reportName);
        }
        sysArgs.caller(this);

        // The report run can not be created with SysArgs therefore create
        // a new Args object. The SysArgs data are copied into the Args object.
        reportRun   = classfactory.reportRunClass(SysArgs::copyArgs(sysArgs, 
new Args()));
    }

    report      = reportRun.report();
    report.interactive(false);

    queryNextUniqueId   = report.query().getNextUniqueId();
    treeQueryVersion    = report.query().version();
}

Only after makereportrun the dialog fires, itemid is set but this always points 
FIKPBARG.run() to the wrong report.

Thanks in advance,

Michael

Reply via email to