PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → date range for reports
date range for reports
Iniciado por gallen.dbmc, 21,jul. 2015 04:55 - 4 respuestas
Publicado el 21,julio 2015 - 04:55
This is possibly a newbie question but I am having problems defining a query for reports:
I have 2 edit controls in a window: EDT_dStart and EDT_DEnd; both are configured for a returned value of YYYMMDD
The query for this report is
SELECT.....
FROM....
WHERE
burial.Burial_Date BETWEEN {EDT_dStart} AND {EDT_dEnd}
The query always returns no data but obviously the parameters aren't being submitted in the right format because if I put in their place the values 20010101 and 20101231 the query works.
What am I doing wrong?
Thanks for the help.
Garry
Publicado el 21,julio 2015 - 11:37
Hi Garry,

> What am I doing wrong?

1. You are not showing us your code, so we don't know what you are doing

2. you are not telling us if you are using the query editor or a text query

3. You are not telling us what DB you are using

4. You are not telling us WHERE you are running the query (if it's
inside the report, I doubt it will find the correct window to get the
fields values from)

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Already there: WXShowroom.com, WXReplication (open source)
Coming soon: WXEDM (open source)
More information on http://www.fabriceharari.com

On 7/20/2015 8:55 PM, Garry Allen wrote:
This is possibly a newbie question but I am having problems defining a
query for reports:
I have 2 edit controls in a window: EDT_dStart and EDT_DEnd; both are
configured for a returned value of YYYMMDD
The query for this report is
SELECT.....
FROM....
WHERE burial.Burial_Date BETWEEN {EDT_dStart} AND {EDT_dEnd}
The query always returns no data but obviously the parameters aren't
being submitted in the right format because if I put in their place the
values 20010101 and 20101231 the query works.
Thanks for the help.
Garry
Publicado el 21,julio 2015 - 20:57
Hi Fabrice
Sorry for being so vague.
I'm using WinDev20 and HFSQL in Classic mode.
I originally created the query in the report wizard based on a new query. When I had problems with that I decided to create and test the query in the Query Editor where it worked but I had to enter the dates as YYYMMDD when it asked for the parameters. My parameters in the window with the button to print the report didn't seem to be coming in in that format (or so I thought).
To make a long story short, I started from scratch and everything worked. As a 2 week old WinDev developer I find I make a lot of mistakes and the IDE sometimes has difficulty keeping up with them but persistence seems to pay off.
I am really enjoying my sometimes frustrating journey so far and the WinDev development environment looks very promising.
Now if I could just figure out how to get someone's age at death into a query...
Publicado el 22,julio 2015 - 16:44
Well, I figured out the age problem, sort of - I used MONTHS_BETWEEN(Death_Date, Birth_Date)/12 which gives me 2 decimals and I'd rather have just an integer.
Next question is: how do I get my parameters (EDT_dStart and EDT_dEnd) to show up on my report.
Publicado el 23,julio 2015 - 04:43
Hot D*amn! I figured it out.
First I declared 2 global variables (gdReport_Start and gdReport_End).
In the report initialization I assigned the values of EDT_dStart and EDT_dEnd to the globals
Then I put a static and an Item on the report Page Header - one of each because I don't really know what I am doing
In the Static I had to enter the caption as [%DateToString(gdReport_Start)%]
The Item looks like the way to go since it allowed me to specify that it was a Date type and let me pick a mask and define the style.
But when I ran the report they both worked!
Not only that but now I think that I can assign the initial values of the EDT's with the value of the globals so that other reports start with reasonable dates.
Man, I'm making progress!