Report header from and to date

How can I get the dates from query window and pass this to be filled in Report header…

Thanks.

You can get the value by finding the related range an its value .
Example - element.query().dataSourceTable(tablenum(ProdJournalRoute)).findRange(fieldnum(ProdJournalRoute, TransDate)).value(); // this will give you the value entered in the criteria.

shall I write a display method?

display Printdate startDate()
{
    return element.query().dataSourceTable(tablenum(ProdJournalRoute)).findRange(fieldnum(ProdJournalRoute, TransDate)).value();
}

like this?

it showing error as “The operand is not compatible with the type of the function.”

It returns a string value like ‘01/01/2018…01/31/2018’.

But I need this date 01/01/2018 to be in from and this date 01/31/2018’ to be in todate, Kranthi…

In that case, you may have to split that string value and show it in from date and to date.

How to do that, Kranthi?

if you are sure that the criteria will be entered in the same format then you can use str2Con.

Example:
container c = str2Con(‘01/01/2018…01/31/2018’, ‘…’);
str fromDate, toDate;

fromDate = conPeek(c, 1);
toDate = conPeek(c, 2);

If that is not the case, add the from date and to date to report dialog.

shall I write in display method or in a new method?
If it s a new method wr should i write?

Write a display method to show the result on the header.

How to pass the date value from query prompt to this container, Kranthi?

Dates value will be entered by user and it will not be same…

You can get it by using,
element.query().dataSourceTable(tablenum(ProdJournalRoute)).findRange(fieldnum(ProdJournalRoute, TransDate)).value();

Yes, Kranthi.
But how to pass this to container to split the string

display str startDate()
{
    container c = str2Con('element.query().dataSourceTable(tablenum(ProdJournalRoute)).findRange(fieldnum(ProdJournalRoute, TransDate)).value();', '..');
    str fromDate, toDate;
    ;
    fromDate = conPeek(c, 1);
    return fromDate;
}

how should i pass the date i gave in the query prompt to split tat as from and to date…

container c = str2Con(element.query().dataSourceTable(tablenum(ProdJournalRoute)).findRange(fieldnum(ProdJournalRoute, TransDate)).value(), ‘…’);

Yes, Kranthi.

its showing the record correctly but there is an dot in to date. May I know how to remove that?

display str toDate()
{
    container c = str2Con(element.query().dataSourceTable(tablenum(ProdJournalRoute)).findRange(fieldnum(ProdJournalRoute, TransDate)).value(), '..');
    str toDate,enddate;
    ;
    toDate = conPeek(c, 2);
    enddate=strRem(todate,".");
    return enddate;
}

Done like this Kranthi…