Normal Topic Initial value (Read 1282 times)
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Initial value
Nov 2nd, 2009 at 8:06pm
Print Post Print Post  
My application, to make matters simple, has 4 elements:

Program:
Cost:
Amount Paid:
Balance Due:

In the programming of this application I have an initial value for the cost, let's say $450.00. My client sends in a payment of $400.00, his Balance Due is $50.00. No problem so far. If I give a client a discount of say 50%, his Cost would be $225.00. When I exit the application all is saved. However if I go back into the same record to change something the cost reverts to the initial value of $450.00. What programming is necessary to change it so that the cost maintains the value I choose instead of the "initial programmed value"??

Peter
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Initial value
Reply #1 - Nov 2nd, 2009 at 8:32pm
Print Post Print Post  
It sounds like you might be setting the value On Form Entry. You probably want to check @IsBlank and/or @IsNew before overwriting the existing value.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Re: Initial value
Reply #2 - Nov 4th, 2009 at 3:14am
Print Post Print Post  
Thank you Erika......but where and exactly how do I install the @IsBlank and/or @IsNew programming functions?

Peter
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Initial value
Reply #3 - Nov 4th, 2009 at 3:54am
Print Post Print Post  
wildwood wrote on Nov 4th, 2009 at 3:14am:
Thank you Erika......but where and exactly how do I install the @IsBlank and/or @IsNew programming functions?


Look at the code in your form. One of the Events probably includes something like:
Cost = @XLookup(@FN, Program, Programs!ID, Cost)

It may not look exactly like that, but something will be setting the Cost in code.

Please post that code and tell me in which Event it appears.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Re: Initial value
Reply #4 - Nov 4th, 2009 at 6:49pm
Print Post Print Post  
Hi Erika,
In my application the cost is the actual "program" ("Father-Son";"Golf";"Tennis Plus"; or "Ice Hockey"
It is in the program element: Program:: On element exit

if program:= "Father-Son" then total amount due:=500.00
Else If program:="Golf" then total amount due:=450.00
Else If program:="Tennis Plus" then total amount due:=450.00
Else If program:="Ice Hockey" then total amount due:=450.00

Peter
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Initial value
Reply #5 - Nov 4th, 2009 at 9:33pm
Print Post Print Post  
Try something like this:

[code]
If @IsBlank(total amount due:)
{
     if program:= "Father-Son" then total amount due:=500.00
     Else If program:="Golf" then total amount due:=450.00
     Else If program:="Tennis Plus" then total amount due:=450.00
     Else If program:="Ice Hockey" then total amount due:=450.00
}
[/code]

The above will only set total amount due: if it is not already filled in.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Re: Initial value
Reply #6 - Nov 6th, 2009 at 4:45pm
Print Post Print Post  
Hi Erika,
Thanks much! This should work.
Now, where do I install this bit of programming:
----On Element Entry?
----On Element Exit?
----On Form Change?
----On Element Change?
----On Form Entry?
----On Form Exit?
----On Element Immediate Change?

I have yet to understand the differences, my bad!

Peter
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Initial value
Reply #7 - Nov 6th, 2009 at 6:34pm
Print Post Print Post  
You should probably put it right where you already have the original code for now.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
wildwood
Full Member
***
Offline


No personal text

Posts: 156
Location: New York
Joined: Apr 2nd, 2004
Re: Initial value
Reply #8 - Nov 6th, 2009 at 7:19pm
Print Post Print Post  
Thank you Erika!!
Peter
  
Back to top
 
IP Logged