Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: OnFilterRecord and Lookup fields

This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Permlink Replies: 0
Mike Collins

Posts: 46
Registered: 9/23/05
OnFilterRecord and Lookup fields  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 20, 2016 1:16 PM
Hi all,

Not sure if this is the best group to post in but here goes. I have a multi-tire development using DataSnap & XE10. I have two ClientDataSets - one lists all users (UserID-PK, FullName, IsUser, IsManager, IsAdmin etc) and another that shows users that within a group (GroupID, UserID, FullName_LookUpField, IsUser_LookUpField, IsManager_LookUpField, IsAdmin_LookUpField).

In the second ClientDataSet I have two lookup fields, drawing in the users FullName and user levels from the first DataSet. The second DataSet is displayed on my UI via a DBGrid.

Now, I want to add in a client-side filter to allow the user to filter the DataSet to show specific user-levels. I initially tried to use the ClientDataSet->Filter propery but it resulted in an exception stating that the Lookup field could not be used in a filter.

So, having done some research I opted to use the OnFilterRecord event. However, at the point that the event fires, the value in the user level lookups do not appear to have been looked up (it simply reverts to the default value of false). However, once the records are displayed, the lookup fields appear to be valid.

I have tried during on the LookupCache for each lookup field but it doesnt make any difference.

Am I missing something fundamental here? Can lookup fields, in client datasets be used / referenced from within the OnFilterRecord event?
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02