Simplicty and flexibility!


SelectionFilter Function


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

SelectionFilter Function

Where can I find help on using SelectionFilter() function in expression builder?

Also, I can't find help on other functions available in expression filter.


Written by Kensington 06/11/13 at 11:49:44 Dataease [{8}]FIVE

Re:SelectionFilter Function

Old sins....

This is a part of the old DFWACTS functions that was developed as a CDF library in 6.x and implemented as internal functions in 7.0.

"Inbuilt DFWACTS CDF's
The largest and most commonly used Custom Functions Library is DFWACTS. This library actually consists of internal DataEase functions, called via the CDF Library facility.
In DataEase 7 the DFWACTS commands are now directly available to the developer as internal functions – in other words, they no longer need to be registered as Custom Functions before use. They can now be called directly from picklists in the DQL and OML Script Editor, and also from the Field Derivation Dialog Box.
In Buttons and Images, the DFWACTS functions are still called as if they were CDF functions, rather than internal functions. This allows developers to use the CDF expression builder to attach conditional log and multiple actions to a Button or Image"

As a CDF it was never part of the "conform" documentation and when converted to internal functions the text above was everything that was included in the manuals....

Since DFWACTS is basically the button actions as functions, a lot of users have been able to "deduct" the functionality but it is amazing that proper documentation was never included or assimilated.

The DFWACTS was never really thought through either, and typical of the Development Management at that time. The task was simply to create functions for all Actions so you would be able to call more than one action on a button and also use actions in derivations.


The problem was of course that the basic understanding on how DataEase works was not part of the task so functions like SelectionFilter was implemented completely "stupid".

This is the definition from the DFWACTS header file:

/***************************************************************************/

/* */

/* Function Name: SelectionFilter */

/* */

/* Function Description: Sets selection filter */

/* */

/* Incoming Arguments: Arguments Data Type */

/* FilterLSide string */

/* FilterRSide string */

/* */

/* Return Value: status int */

/* */

/* Usage: Sets a selection filter. A space is appended to FilterLSide if */

/* it does not end with a space. An operator must be included in */

/* either FilterLSide or FilterRSide but not in both. */

/* */

/* Notes: Could be enhanced for operator selectivity. */

/* */

/* DFW Action(s): Selection Filter */

/* */

/***************************************************************************/


If this didn't make you any wiser, a little explanation might ;-)

Filters in DataEase is a very strong feature and it is in reality simply a string which is interpreted by the parser. How this string come into being doesn't really matter. We exploit this a lot on DG3 where you transfer the filter via the URL (but that is another story).

SelectionFilter() simply is a way of setting this filter string, but since the people that created it obviously didn't use DataEase they never realised how stupid they made it.

SelectionFilter() basically has two string paramters:

int SelectionFilter(RightSideArgument,LeftSideArgument) that together will become the full Filter string. To have two arguments is meaningless and would only be beneficiary if the filter had been built up with "" etc which it isn't.

so for instance if you have the text field Name and you want to filter on A* (i.e. all occurrences where name start with A) you would think the function would be like this:

SelectionFilter("Name=","A*") .... but if you try this, you would get "Selection Criteria Invalid"....

And this is where it would have stopped for me, if I didn't have a deep insight into how this really work in PRISM.....

Since name is a text field the filter itself need to contain the "" which is an "imposition" when the string sent over also use ""...

So the format for this function would in fact be:

SelectionFilter("Name=",concat(chr(34),"A*",chr(34))) which would result in the filter Name="A*" being sent to PRISM8.

But just to nail the stupid LeftSide/RightSide argument once and for all, the following would work just as well:

SelectionFilter("",concat("Name=",chr(34),"A*",chr(34)))

As would:

SelectionFilter(concat("Name=",chr(34),"A*",chr(34)),"")


Written by DataEase 06/11/13 at 12:33:46 Dataease [{8}]FIVE

Re:Re:SelectionFilter Function

Thanks for the detailed reply. It is very helpful.

the reason I wanted to use this function was to open another document with pre-set search criteria from which user could choose an item and return to the main document. I have defined a lookup but because the number of item in lookup is very large, it takes un-acceptable amount of time. Also user wants to be able to select using description instead of bound code.

(See attached picture)

However I faced many issues trying to do this:

1. I had to implement it using two buttons as shown in the picture. first button opens the search document and sets a global variable to returned result.

2. Second button applies the result using SetValue(). Here again i had an issue. When I applied the global variable to JobCode lookup field it wouldn't show it. In the end I used a virtual field which derived its result from JobCode field to display the returned code. Opon saving the document JobCode shows.

I couldn't achieve this using single button.

I am not sure if I am making it too complicated or is there a simpler way of achieving the same. I will appreciate a comment from you on this.


Written by Kensington 06/11/13 at 17:07:22 Dataease [{8}]FIVE

Re:Re:Re:SelectionFilter Function

I have to ask, but it might be to obvious....

Why don't you just use OpenRelated and ReturnDataTo?

I can't see this needing to fall outside the default functionality?


Written by DataEase 06/11/13 at 18:23:08 Dataease [{8}]FIVE

Re:Re:Re:Re:SelectionFilter Function

Yes, the popup document can act like OpenRelated but I didn't know anything about ReturnDataTo. Where can I find more information about these two functions.


Written by Kensington 06/11/13 at 19:50:30 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:SelectionFilter Function

It is basically the same as CTRL-F10 and CTRL-ENter in the DFD....

Return Data To

The Return To icon works in conjunction with the Open Related Form icon. Its function is to return data from the related form to the original form.

When you click this icon it fills in all Match fields in the current record with the values from a selected record in a related form. Return Data to lets you display a related form in Form View or Table View, search for related records using selection criteria and wild cards in one or more fields, and return values for all the Match fields in the original record.

How to Return Data from a Related Form

  • Click the Form Open Related icon, or choose Goto>>Related Form... Choose the form you want from the Related Form dialog.
  • Find the record you need in Form View or Table View by entering QBF criteria, using wild card characters, or by paging through the records.
  • Click the Return To icon, or choose Goto>>Return Data to. DataEase displays your original form, automatically fills in all Match field values, and calculates all derived values based on the returned data.

Written by DataEase 06/11/13 at 21:47:15 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:Re:SelectionFilter Function

Thanks, managed to redo the search with ReturnDataTo and it works fine.


Written by Kensington 07/11/13 at 23:32:27 Dataease [{8}]FIVE
DG3_ForumList