Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 11 Monaten, 3 Wochen
Letzter Beitrag:
vor 11 Monaten, 3 Wochen
Beteiligte Autoren:
Scott Daughtry, Al, Fabrice Harari, DerekT

Query user for date range for filtering report?

Startbeitrag von Scott Daughtry am 29.01.2017 06:17

Forgive me if this has been covered countless times elsewhere - I've looked at can't find an answer

The report is simple (columnar) and non-relational using the HFSQL driver. The table contains a date field (transaction date). The report is sorted on the transaction date and then on a secondary field.

I want to present the enduser with a popup window that they define the starting and ending dates via entry fields (likely two DATE variables that has popup calendars available). When they click the window's EXECUTE button the window would close, pass the start and end dates to the report.

From there the challenge for me begins and I start chasing my tail. What code to I embed in the report's initialization area to properly HFILTER() the report so it prints only the records that are >= and


Hello Scott

I am sure you will receive a variety of answers here is one option :

HFilter() is a global setting on a file until it is de-activated so it can be set anywhere and doesn't have to be part of the report. In fact it is better not to be embedded as that limits the usefullness of the report to the embedded option. When you set the HFilter() outside the report then the report becomes a process to report whatever the available data is.

Set the HFilter() in the data popup window as part of the Execute button code and then run the report - also from the execute button code. After the code that starts the report you will need a hdeactivatefilter()

There is a wizard to write the hfilter() statement for the file. Just start typing HFilte and then wait for the code editor to prompt you .


von Al - am 29.01.2017 11:58
An alternative is to execute a query against the datafile based on the date range entered and the sort order requirements.
Load the results of the query into a table control and base the report on the table.
The table control would be hidden (placed off screen on your window) from the user.

For simple tabular reports this works out of the box.
Once you have placed the table control on your window the is even an option to 'create a report from a table' available that does the work for you.

von DerekT - am 29.01.2017 12:10
Greetings all,

I wound up creating 2 global date variables + a popup window with two date entry fields; within the report startup code I call that window, define the two dates (low and high) and activate them with hfilter() in the report's startup code. Worked like a champ - thank you for steering me in the right direction - I appreciate it!

Now I have a different problem; one of the *.FIC files had to have a new key built on a date field - how do I update the same *.FIC file on the customer's machine (since its structure now doesn't match the updated Analysis)?

von Scott Daughtry - am 29.01.2017 23:10
Hello Scott

The quick & dirty way is to send a copy of the updated wdd file to the client and then use Teamviewer and run WDModfic on the clients computer. That will buy you some time to figure out a more sophisticated method.


von Al - am 29.01.2017 23:36
Hi Al,

I don't have/use Teamviewer... and I can't get WD21 to simply modify the structure of the two *.FIC files (I added a Duplicate Key to a date field within each table and saved the Analysis) on my own test machine without wanting to add new controls to windows / reports / forms. I let it do it the first time and it completely screwed up my application...

von Scott Daughtry - am 29.01.2017 23:42
Hello Scott

WDModfic.exe is a stand alone exe that you can load on the client side. Its sole purpose is to change the file structures and it will have no affect on the application.
(It also needs some dll's to run)

When you change the analysis in the development environment, that is a different matter and yes it will offer to make changes to the app but you can ignore them.

There have been a few discussions in the forum about client side file changes so I am sure that something will turn up in a search.

For me it is slightly different because our clients are either hosted on our servers or their own and we directly maintain each installation.


von Al - am 29.01.2017 23:54
Hi Al,

If you're ever in Albuquerque please let me buy you a beer :)

I regressed backwards, ran the WDModfic manually to update the two FIC/NDX files and then moved forward - my concern is the next time I Sync the analysis and the application that its going to want to add/modify controls to my established windows/forms once again - the popup list seemed to scroll forever with suggested changes that I eventually gave up selecting the droplist option to leave it alone..is there an IDE switch that I can set to stop WD for wanting to nuke every window/form just because I added a new index to two tables, or am I now forbidden from syncing my app ever again because it will want to modify every window now?

von Scott Daughtry - am 30.01.2017 00:34
Hello Scott

That's a left turn for Albuquerque isn't it ? Thanks for the offer of a beer :)

The analysis is the heart of Windev so I can't imagine there is any way to turn off the updates.
I think the issue is exacerbated by the fact that the app is based on the RAD tool so there will be file links everywhere to make it all work. In my apps I have no file links at all.


von Al - am 30.01.2017 00:46
Hi Al,

A few left turns... do you prefer domestic brew or import ?

I tinkered around with the WD installation builder and used the option to modify the database structure during the install. I tried this concept several times by copying over the old database files (which lacked the key) to the target folder, ran the new setup program and each time the application ran like a champ, so I have (some) faith that the WDModfic program successfully changed the two table's structures like it should have. I don't like the size of the setup.exe that WD generates (or that it includes the entire framework), but I need to get out of the mindset that I need to conserve every byte of space on the target computer's hard drive (in the day/age of 10TB hard drives) - I still remember buying my first 20MB hard drive with my dad and thought it could never get filled up ...

von Scott Daughtry - am 30.01.2017 03:17
Hi Scott,

it seems to me that you are confusing different things...

1. there are several ways to update your physical files when you change the analysis:
A- from the analysis itself (proposed automatically) for your test files
B- via wdmodfic (run manually or automatically during install of a new version)
C- with the hmodifystructure in your project init code

2. If you use 1A, ie if you click yes when proposed to modify the file structure from your analysis, there are SEVERAL steps involved.
First, you have to select the physical files to update (classic or C/S)
Second the file update is done
THEN AND ONLY THEN does the wizard offer to modify your project: YOU CAN SAY NO!!! Just close that window without validating and your project will NOT BE MODIFIED.

3. It doesn't matter if you update your customers files via 1B or 1C, there will be NO CHANGE in yor project at that time.

Best regards

von Fabrice Harari - am 30.01.2017 12:18
Hi Fabrice,

For some reason when I closed the Analysis something would flash in the center of the screen - the FIC files weren't being automatically updated. I would then manually execute from the IDE the option to sync the app with the analysis - I would then get a popup that listed basically every window/form in the app and a droplist to either add a control to that window or ignore it - there were probably 50+ entries in that scrolling list. The first time I agreed to the changes, compiled the program and then every data insertion resulted in empty database records being added to the table. I exited WD, restored that folder from backup, made the two changes to the analysis again (i.e. added a key to a date field in each table), exited the analysis (again, screen flash in the center of the screen) and manually sync'd the analysis to the program - this time ignoring the recommendations to add controls to windows.

Everything worked out in the end - I even got the WDINST to include the utility to update the tables in an existing folder working - my concern is if the next time I, for whatever reason, need to re-sync the analysis to the app is the same popup window going to appear to add 50+ controls to my windows/forms for those same two key fields going to appear or not

von Scott Daughtry - am 30.01.2017 15:01
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.