how to display Date range in report

Hi All,

i have small problem to display the date range in report header am following this way but its showing some error like"Operand type are in compatible with the operator".But my variable is date type only can you please any one give some suggestions.

deliveryDate =this.query().dataSourceTable(tablenum(PurchLine)).range(2).value();

Thanks in advance

nani

Please check in this querey(this.query().dataSourceTable(tablenum(PurchLine)).range(2).value():wink: with the following things

  1. whether range(2) is pointing to the date field. or better specify the field by makinf use of fieldNum(). or Please verify your 2nd range in datasource should be of date type.

  2. cross verify the deliveryDate variable is of type date, might be it is UTCDateTime variable

Hope it helps you

Hi prasana thanks for your reply ,my delivery date data type is date only and in report my date field range also 2 but its not working showing error.

QueryBuildRange.value() accepts and returns strings only. If you’re specifying the value, you usually use queryValue(), queryRange() etc., if you want to convert it back, you have to parse it yourself.

It’s not to as easy as you think - value() can return for example “01/01/2012”…“31/01/2012”. How do you want to convert it to single date?

But if you just want to display it in a report, you may simply show the string value itself.

ya ok thank you,so by using query we are not possible to return date values? OK thank You Martin .i will try in some other way

If you have just a single date in the range, e.g. the filter value is “01/01/2012”, you could parse it to date data type - remove quotes around the value and call str2date() to do the conversion. The problem is that not all ranges represent a single date, therefore the conversion is simply not possible in some cases.

Hi All

i got the solution for this date Range last week.I.e we will return the date as a string it will print in header. i.e declare datefiled like Str transdate,

and return the same str then only it will print in header

Thanks

Nani

hiii Martin,

just follow this methods You can easily date range in report…

Its is

Class declaration

public class ReportRun extends ObjectRun
{
TransDate fromDate;
TransDate toDate;
dialogField dialogFromDate;
dialogField dialogToDate;

}

fatch

public boolean fetch()
{
;
while select sharecapital where (sharecapital.DateofAdmn >= fromDate && sharecapital.DateofAdmn <= toDate)
return true;
}

dialog

public Object dialog(Object _dialog)
{
DialogRunbase dialog = _dialog;
;
dialog.addGroup("@SYS40");

dialogFromDate = dialog.addFieldValue(typeid(TransDate), fromDate, “@SYS939”, “@SYS26930”);
dialogToDate = dialog.addFieldValue(typeid(TransDate), toDate, “@SYS15867”, “@SYS26929”);

return dialog;
}

getfromdialog

public boolean getFromDialog()
{
;
fromDate = dialogFromDate.value();
toDate = dialogToDate.value();

return true;
}

Thanks & Regards

Nitesh Gangrade [:D]

That’s a value of DialogField, not QueryBuildRange as in question.

this query return all transaction records…in that date range but while u selecting the acc no or other think then it willl not working…all acc no data showing how to show on selective acc no info in that range

Hi Nitesh

I tried your solution and it’s given me an error that says that sharecapital is not declared. I tried solving it, but I’m not winning.

Thanks

Sinoyolo

Hi,

please send me the solution for this .i have a requirement for same. please send it .its urgent

Thanks in advance

Regards,

Murali

Hi Martin,

How i will display the range (“01/01/2012”…“31/01/2012”) on the Report and How i will Get that range into string ?

Thanks in advance,

Murali.

As discusses above, range value already are strings, so I don’t understand what’s the problem. Just call value() method.