PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Using hFilter.
Using hFilter.
Iniciado por guest, 19,nov. 2015 16:11 - 8 respuestas
Publicado el 19,noviembre 2015 - 16:11
Hi all,

I am in a bit of a struggle with hFilter. I want to add Datedifference(xxx,xxx,) to the next filter:

HFilter(Klachten,"Offerte='"+Offertenummer+"'")

Anybody who's willing to help me out here.


Much obliged.

Best regards,

Aad
Publicado el 19,noviembre 2015 - 22:02
complains of an offerte over a certain amount of time? Is that what you want?

regards
Allard
Publicado el 20,noviembre 2015 - 00:23
Hi Allard,

hFilter is not the user friendliest function in Windev but you can certainly do a lot with it if you know how to use it.
I want to see a list of estimates older than 30 days, that's all :-)

Best regards,

Aad
Publicado el 20,noviembre 2015 - 01:02
Hi Aad,

You said it... HFilter is not the easiest function to use. I too started off using HFilter but very soon came to the conclusion that for complex requirements it was just too cumbersome. I no longer use HFilter for anything. Instead I use Queries as they can do everything I need, especially for more complex requirements! :cool:

There are a few "techniques" you need to know about (like resetting parameters, using Null parameters etc.), when using queries in WX but once you know them (and they've been discussed at length and in great detail in previous posts on this forum), then you're good to go :spos:


Something like?

SELECT ID,EstimateDate,EstimateAmount FROM Estimate WHERE EstimateDate > {Param_Date};
Where Param_Date is a date with 30 days added and passed to the query.
Publicado el 20,noviembre 2015 - 04:00
Hello Add

I have never figured out the Hfilter() syntax so I always use the wizard and this is the code it generates for a date comparison on one of my files.

sBrowseKeyItem is string
// Enable the filter
sBrowseKeyItem = HFilter(Crtrans, "DataEntryDate>='"+StartDate+"'"...
+" AND DataEntryDate<='"+EndDate+"'")

// Browse the filtered records
HReadFirst(Crtrans, sBrowseKeyItem)
WHILE NOT HOut()
// Insert your process here

HReadNext(Crtrans, sBrowseKeyItem)
END
// Disable the filter
HDeactivateFilter(Crtrans)


Regards
Al
Publicado el 20,noviembre 2015 - 08:42
Hi Aad,

there should be no need to use DataDifference() in HFilter(). You can first calculate the date to use for filtering (i.e. current date -/- 30 days) and use this date in the way as Al wrote. Or something like

HFilter(Klachten,"Offerte='"+Offertenummer+"' AND InvoiceDate <='" + CalculatedDate + "'")
Publicado el 20,noviembre 2015 - 10:44
Hi Aad

As DarrenF stated why not use queries?

I use them a lot. It works like a charm. Especially for filtering stuff. For instance the dates. Just select a parameter and a begin and end date and you are good to go.

I have a search screen in my app that allows for searching on almoast everything. It uses a ton of parameters but only actually uses a param when it is needed.

I use internal queries if possible. ( on controls ) If it is just code I use queries to do the creation of a particular data set in code. When a querie is run you can use it like if it was a file works great. It simplifies the code

regards
Allard
Publicado el 20,noviembre 2015 - 15:27
Hi guys,

Thanks for all your suggestions. In the meantime I have a working solution the old way, like Al and Stefan suggested.

HFilter(Klachten,"Offerte='"+Offertenummer+"' AND KlachtUitgevoerd = ''"+" AND Gemelduitvoerder <='" + IntegerToDate(DateToInteger(Today())-30) + "'")

It won't win a beauty contest but it works. I will look into queries, it seems easier to achieve things, specially the internal ones.

Best regards,

Aad
Publicado el 20,noviembre 2015 - 15:54
Hi Aad,

Yes way easier. And indeed verry easy to get the hang of it. You will be doing yourself a big fafour if you look into the matter.

Regards
Allard