Simplicty and flexibility!


Filtering records via a button in form view


Started by
Search
You will need to Sign In to be able to add or comment on the forum!

Filtering records via a button in form view

I have a member’s form with a choice field (radio-box) which has three (3) categories: Member; New Convert; and Visitor. Is it possible to filter records from a button that will filter records, in form view,according to the option a user chooses? For instance, if member is selected then only those records that has Member checked will be displayed and can be searched.

Also, is there a way for a user to clear a radio-box choice field ? If not, then there will need to be an option to display all records or clear the filter from the button. It seem that once a user makes a selection in a radio-box choice field there is no going back unless the form is cleared.

Thank you in advance for your help.


Written by 01/02/21 at 04:25:51

Re:Filtering records via a button in form view

Download Sample

You can of course add a choice (default maybe) that is None or something like that, as you as you rightly have pointed out can't deselect a RadioBox from the RadioBox itself.

However there is plenty of ways to do this.

The simplest way is simply to hit F6 (field clear) when the radiobox has focus. This is a little "Old style" as modern users want to click themselves out of everything rather than using function keys etc.

So in the attached example we also add a dblclicked event on "your" Radiobox so if you dblclick on it it will clear (just try).

The second question is how to filter your data from a button.

That too is rather straight forward.

Here we use the two functions SelectionFilter() and FilterClear().

Selectionfilter is a very powerful function that is quite underutilized, maybe because it is slightly illogical.

SelectionFilter(String,String) sets the filter as a string. It has as you can see two arguments so it would be logical to think that it would be the column in the first

and the value in the second...but no. It seems that it has two argument to circumvent the 255 boundry so you can set a 512 long filter....

So the filter is the combination of the two

Here: SelectionFilter("MyRadioBox=","Member") or SelectionFilter("MyRadioBox=Member","") or SelectionFilter("","SelectionFilter("","MyRadioBox=Member")

are all the same...yes, confusing.

An here we dodge a bullet, as the value is a choice and hence is to be represented in a derviation (filter) without "" but what if the field was text?

SelectionFilter("MyRadioBox="Member"","") is obviously not allowed/working.

Pre DE8 this would have been a serious nut to crack but luckily in DE8 we have escape characters so the solutio is simply.

("MyRadioBox=.'Member.'","")

Characters include is:

" = /'

CR = /CR (New line)

TAB=/TB (Tab)

We hope this helps.


Written by DataEase 01/02/21 at 11:02:08 Dataease [{8}]FIVE

Re:Re:Filtering records via a button in form view

Thank you for your quick response, I truly appreciate it. The radiobox solution worked as advertised. However, I am not having much luck with the button’s selection filter solution. I am not savvy enough as I do not have much experience.

MemStatus is the name of the radio box choice field which have three choices: Member, New Convert, and Visitor. I saw your discourse on the illogical workings of the Selection Filter as well as the simple solution to my issue – (MyRadioBox=.’Member.’”, “”) I also saw the escape characters but do not understand their relevance. In any event, I placed the following derivation in the Member button after selecting Selection Filter(“MemStatus=.’Member.’”, “”) and received a 401 Setting Selecting Filter. Selection criteria is invalid error message. I did not know that the apostrophe was a valid DataEase symbol. I was wondering if you could provide the exact formula including the escape characters, if needed, based on the parameters I provided, Based on that I can apply the formulas to the other buttons. Also, I downloaded the sample and unzipped the file but cannot find it. Is there a user name and password associated with it? I apologize for the imposition on your valuable time. Thank you.


Written by Barry Sweet 03/02/21 at 03:03:05 Dataease [{8}]FIVE

Re:Re:Re:Filtering records via a button in form view


Hi Barry.

Sorry for confusing you with the elaborate explanation of the illogic of the SelectionFilter() function.

RadioButtons use a choice list and in DataEase language they are represented by the value WITHOUT "".

Selection Filter("MemStatus=Member", "")
Is the correct way of doing it, if you look at the code on the buttons you will see this.

The reason we created the escape characters is so you can represent characters like " inside " " i.e. string within a string.

When you unzip the file you can decide where to put it, but if you just downloaded the file and unzipped it it will be in a catalog called RadioBox under your download catalog.

There is no username/password. It should start up directly with the correct form but if not, just hit enter in the login screen and it will do as prescribed.


Written by DataEase 03/02/21 at 12:28:09 Dataease [{8}]FIVE

Re:Re:Re:Re:Filtering records via a button in form view

Written by Barry Sweet 04/02/21 at 02:32:36 Dataease [{8}]FIVE
DG3_ForumList