Normal Topic detecting subform changes within main form (Read 673 times)
FSGROUP
Full Member
***
Offline


No personal text

Posts: 179
Location: Edmonton, Alberta, Canada
Joined: Jan 14th, 2004
detecting subform changes within main form
Feb 2nd, 2004 at 5:10pm
Print Post Print Post  
seeing as the subform name does not show up under Element in the program editor of the main form, I reckon this isn't possible?
  
Back to top
IP Logged
 
Justin_ICC
Junior Member
**
Offline



Posts: 95
Joined: Feb 5th, 2004
Re: detecting subform changes within main form
Reply #1 - Feb 6th, 2004 at 3:06pm
Print Post Print Post  
As far as I know there is no direct way to do this. Having just tried to do some interaction between subform and mainform Bharat gave me an idea.

What you need to do is add some programming to the subform. Open up the Program Layout for the subform. Select the forms name in the Element drop down list and then go to either On Immediate Change or On Element Change depending on how quickly you want the other form to respond.  You will then want to insert the following code (assume the name of the subform is Items and the main form is Purchase Order):
Globalvalue ("Items Change",1) ;
writeln (@globalvalue ("Items Change") + " is new Globalvalue") ;
delete the write ln or comment it out when youa re sure things are working.

I am using 1 for True & 0 for false in this example as I haven't played with booleans yet so i'm not sure of the exact case/spelling.

Now on the main form you will need to add some programming. Select the forms name in the Element drop down list and then select On Form Exit from the event drop down list and add the following code.
Globalvalue ("Items Change",0) ;
writeln (@globalvalue ("Items Change") + " is new Globalvalue") ;

What this code has done is when there is a change it sets a global variable to contain this change. When the user then leaves the current form it then resets the variable.

To make use of this variable simply insert into the code where youa re trying to determine if the subform has changed:
if @globalvalue("Items Change") = 1 then
{
     ....
}


I hope this helps if you need more clarification just ask away Smiley

Justin
  
Back to top
 
IP Logged
 
FSGROUP
Full Member
***
Offline


No personal text

Posts: 179
Location: Edmonton, Alberta, Canada
Joined: Jan 14th, 2004
Re: detecting subform changes within main form
Reply #2 - Feb 6th, 2004 at 4:15pm
Print Post Print Post  
thanx for the response. what i hoped for was to calculate a total of all subform items anytime there was a change to the items, this total appearing in the main form(on the fly). i ended up creating a command button that did the calculation when pressed, but i also calculated it when in the main form On Exit.

a little more elbow grease, but it works    Grin
  
Back to top
IP Logged
 
Justin_ICC
Junior Member
**
Offline



Posts: 95
Joined: Feb 5th, 2004
Re: detecting subform changes within main form
Reply #3 - Feb 6th, 2004 at 4:22pm
Print Post Print Post  
Take a look at 2 of the other discussions I started - non-field layouts and Note lines ona  file - both of these may have information you might find useful. There is a problem with the solution I just gave you - the global variable is stored on the server - it causes problems if you have multiple users running at the same time.
  
Back to top
 
IP Logged