Refreshing data in a subform

Questions and Answers about DataEase for Windows

Refreshing data in a subform

Postby robb » Thu Jan 13, 2011 1:47 pm

I have a subform that shows me related data for the record i am using in the main part of the form. Is there a way of getting the data in the subform to refresh using a button so that any fresh related records are visible?
robb
 
Posts: 45
Joined: Thu Jan 07, 2010 9:20 am
Has thanked: 0 time
Been thanked: 0 time
 

Re: Refreshing data in a subform

Postby Graham Smith » Thu Jan 13, 2011 2:12 pm

I have never seen a simple way to do this.
Graham Smith
DataSmith, Delaware
"For every expert there is an equal and opposite expert.", Arthur C. Clarke (1917 - 2008)
"X-Clacks-Overhead: GNU Terry Pratchett"
User avatar
Graham Smith
 
Posts: 2501
Joined: Fri Sep 07, 2007 11:31 am
Location: Delaware, USA
Has thanked: 0 time
Been thanked: 1 time
 

Re: Refreshing data in a subform

Postby Adrian Jones » Thu Jan 13, 2011 4:38 pm

The action ClearSelectionFilter happens to force a re-read of the data.

However, it also move you to the first record in the dataset.

So what you need is a way to guarantee that the record you want to look at is the first one in the dataset. Better, the only one.

In my experience, there are two ways to do this: either navigate to the document in question via form open related (so that the relationship filters the dataset to the one and only main record in question), or 'start one level higher' with a main form that wraps your target main form, somehow has the ID for the target main record, and filters this by displaying it as a subform (your original subform is now a nested subform).

I say all this because it means that you can't simply be looking at your one and only document over this data, the one you use for all data functions. Instead, you have to think about how you will navigate to your record, and create screens whose purpose is to work on one and only one main record at a time.

do I make sense so far?
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 

Re: Refreshing data in a subform

Postby Graham Smith » Fri Jan 14, 2011 2:04 pm

Adrian Jones wrote:I say all this because it means that you can't simply be looking at your one and only document over this data, the one you use for all data functions. Instead, you have to think about how you will navigate to your record, and create screens whose purpose is to work on one and only one main record at a time.

IOW, no simple way. :mrgreen:

IIRC, Pete and I talked about this years ago. DFD had a function [Ctrl-F9] that would Recalculate a record. This was never implemented in DFW or Ffenics for some reason (no one knows why). It would be nice to have this in Ffenics and have it both Recalculate and Reread a record so that everything would be updated.
Graham Smith
DataSmith, Delaware
"For every expert there is an equal and opposite expert.", Arthur C. Clarke (1917 - 2008)
"X-Clacks-Overhead: GNU Terry Pratchett"
User avatar
Graham Smith
 
Posts: 2501
Joined: Fri Sep 07, 2007 11:31 am
Location: Delaware, USA
Has thanked: 0 time
Been thanked: 1 time
 

Re: Refreshing data in a subform

Postby Adrian Jones » Fri Jan 14, 2011 2:53 pm

1. Rob didn't say simple.
2. Define 'simple'.
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 

Re: Refreshing data in a subform

Postby Graham Smith » Fri Jan 14, 2011 9:05 pm

Adrian Jones wrote:Define 'simple'.

Something that is easy to implement and is flexible. Something that can be used in general circumstances.

ClearSelectionFilter() works, but only in a very limited circumstance. The form has to essentially be some version of a single record form. That's not to say I have not used this, but it does require a very specific way of setting things up and I've gotten more than a little resistance from users over this approach.

There is no practical solution of the "just use a button with this action/script" variety. You have to basically build an Aspect or set of Aspects with this specific function in mind.
Graham Smith
DataSmith, Delaware
"For every expert there is an equal and opposite expert.", Arthur C. Clarke (1917 - 2008)
"X-Clacks-Overhead: GNU Terry Pratchett"
User avatar
Graham Smith
 
Posts: 2501
Joined: Fri Sep 07, 2007 11:31 am
Location: Delaware, USA
Has thanked: 0 time
Been thanked: 1 time
 

Re: Refreshing data in a subform

Postby Adrian Jones » Sat Jan 15, 2011 6:12 am

Well, the way I describe is pretty much the simplest way to do what (I think) Rob wants right now.
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 

Re: Refreshing data in a subform

Postby robb » Fri Jan 28, 2011 2:54 pm

The customer found the simplest way, he changed his mind on how he wanted it to work and the problem no longer exists!!!
robb
 
Posts: 45
Joined: Thu Jan 07, 2010 9:20 am
Has thanked: 0 time
Been thanked: 0 time
 

Re: Refreshing data in a subform

Postby lumberjackshaw » Thu Jul 28, 2011 6:25 pm

I would like to add my name to the petition to add a feature to refresh the sub form data.
--Josh

Associate with men of good quality if you esteem your own reputation; for it is better to be alone than in bad company.
-George Washington
lumberjackshaw
 
Posts: 207
Joined: Mon Jan 17, 2011 8:07 pm
Has thanked: 0 time
Been thanked: 0 time
 

Re: Refreshing data in a subform

Postby lumberjackshaw » Fri Jul 29, 2011 6:31 pm

It should be noted that the latent data in a sub form can actually be saved to another sub form record inadvertently.

Here is how I have achieved it.
My main form (customer) has a field that maintains the primary contact key. The aspect over the form has 2 sub forms. The first list the names and titles of all of the contacts associated with that customer. Each contact in that sub form has a button that can set that contact as the primary contact.
The primary contact information (most of it) is displayed using virtual fields located on the customer table. The Phone/Fax/Mobile numbers, however, are not. I have created for them a separate table and as such this table is my second sub form.

The script on the "Set Primary" button is as follows:
Code: Select all
number "n" .
far_Customers.PrimaryContact.value := ContactKey.value .
n:=RecordSave() .
text "key" .
key := far_Customers.CustOrgKey.value .
n:=clearselectionfilter() .
n:=selectionfilter("CustOrgKey=",key) .


I did, however, fail to take one thing into account. I did not use virtual fields for the numbers and so, when the script, having changed the primary contact key, triggers the record save, it saves the data on the screen in that sub form, as additional rows in my numbers table under the new primary contact.

While I do already know how to fix the issue I decided I better post the issue as I am not sure it should be possible and I am pretty sure that if the sub form had a refresh option, this problem would be resolved(jab, jab). :-)

****I inadvertently (Blind apparently) post this to a Dataease topic rather than a Ff topic. #-o I will re-post in the appropriate place.
--Josh

Associate with men of good quality if you esteem your own reputation; for it is better to be alone than in bad company.
-George Washington
lumberjackshaw
 
Posts: 207
Joined: Mon Jan 17, 2011 8:07 pm
Has thanked: 0 time
Been thanked: 0 time
 
 

Return to DataEase for Windows

Who is online

Users browsing this forum: No registered users and 1 guest

cron