NetTalk Central

Author Topic: Using Calendar to set Date fields is giving weird dates  (Read 4401 times)

britech

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Using Calendar to set Date fields is giving weird dates
« on: August 11, 2010, 04:39:24 PM »
HI folks,
I'm trying to get a date from a calendar to use in a report filter and I'm getting very weird dates.
Sometimes it works, sometimes I get year 1801 , and all sorts of variatons.
LOC:FROM date is a DATE type formatted  as d6.

Is this the proper way to capture a date from a calendar.

Loc:FromDate =  p_web.dformat(p_web.GetValue('FromDate'),p_web.site.DatePicture)

Look forward to any suggestions.
Brian

Currently using NT 5 PR 26
6.3 build 9055
NT5 PR26
6.3 9055

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Using Calendar to set Date fields is giving weird dates
« Reply #1 on: August 11, 2010, 06:40:36 PM »
The dFormat statement should match the picture you are using.

Most dates are formatted as
p_web.site.datepicture, hence the dFormat in the example.
But if you've set yours to D6, then you should set the dFormat to D6 as well.

cheers
Bruce

britech

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Using Calendar to set Date fields is giving weird dates
« Reply #2 on: August 12, 2010, 04:29:00 PM »
Hi folks,

I made sure the Web Server default was D06 and  all my local variables were also D06.

My dates now display fine on the report , and my report date filter WILL work as follows:

ORD1:ClientID=LOC:Client_ID and ORD1:OrderDate  >=  LOC:FROMDate
------------------------------------------------------------------------------------------------------------

If  I try a filter like this:

ORD1:ClientID=LOC:Client_ID and ORD1:OrderDate  >=  LOC:FROMDate  and  ORD1:OrderDate  <=  LOC:TODate

I get  ERROR 404 Page cannot be found.

The filter seems to choke if I add the second "and"  filter component.
Am I missing something obvious here?
Look forward to any suggestions.
Brian



NT5 PR26
6.3 9055

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Using Calendar to set Date fields is giving weird dates
« Reply #3 on: August 12, 2010, 06:26:16 PM »
Perhaps the report is empty, and hence not generated, if the filter includes the second date?

I don't recall offhand what I did to make it "always print" - even if there's no data.
Is this abc or legacy?

cheers
Bruce

britech

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Using Calendar to set Date fields is giving weird dates
« Reply #4 on: August 13, 2010, 05:34:53 AM »
Hi Bruce,
Using ABC standard Clarion report template.

I just tried this and it worked, althoug I noticed that IE posts an Error 404 Page not found on the IE tab, just before the PDF is generated.
The PDF generates and is viewable, but that error is visible on the tab before it displays.

I have to take another look at my LOC:ToDate variable to figure out why it causes the entire report to fail into a 404 error page not found.


THIS WORKS:

ORD1:ClientID=LOC:Client_ID and ORD1:OrderDate  >=  LOC:FROMDate  AND  ORD1:OrderDate <= 76556

Brian
NT 5  PR 26
6.3 9055 ( I have 7.2 , but I prefer the devil I know.)
NT5 PR26
6.3 9055

britech

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Using Calendar to set Date fields is giving weird dates
« Reply #5 on: August 13, 2010, 08:46:57 AM »

Hi folks,

I have a NetWebForm that I use to capture a FromDate and a Todate.

I have a button on that same Netwebform that calls a Report.
This is my Report filter.
ORD1:ClientID=LOC:Client_ID and ORD1:OrderDate  >=  LOC:FROMDate  AND  ORD1:OrderDate <= LOC:ToDate

 I've checked that I have valid Clarion dates in both LOC:FROMDate and LOC:ToDate after capturing it in code at the following embed point:

Prime Report Options When run  in Web mode:

Loc:FromDate =  p_web.dformat(p_web.GetValue('FromDate'),p_web.site.DatePicture)    !Set Date variables
Loc:ToDate   =  p_web.dformat(p_web.GetValue('ToDate'),p_web.site.DatePicture)

This filter fails the first time I run the report. If I cancel the pop up Report viewer window, and re-run the report without changing the two date range fields on the Initial NetWebForm,  the filter works fine.

Why would this report  filter work the second time, and not the first?
ORD1:ClientID=LOC:Client_ID and ORD1:OrderDate  >=  LOC:FROMDate  AND  ORD1:OrderDate <= LOC:ToDate


Suggestions
Brian

NT5 PR26
6.3 9055


NT5 PR26
6.3 9055

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Using Calendar to set Date fields is giving weird dates
« Reply #6 on: August 13, 2010, 06:29:54 PM »
I presume you've bound both Loc:Fromdate and Loc:Todate?

perhaps put a debug statement in to see the values in the two variables just after the priming?

cheers
Bruce