CodeChargenewbie
Posts: 114
|
| Posted: 09/05/2007, 1:40 PM |
|
First, as my name dictates, I'm a bit of a newb at this program -- I started using it about 1 1/2 weeks ago.
Here's what I want to do (please don't take offense to my dumb-it-down approach):
I have a Record page. There's a label on the page called Sub. The label's control source is also called Sub, which belongs to a table in a database. When this page is displayed, a value will be written into the label, governed by Sub. Now what I want to do is take Sub and divided it by 100 and display it in the same label. That is, take a value from a table, dviide it by 100, and then display ithe result in the label.
I tried adding custom code in javascript and the label didn't display anything. I then tried php and it also didn't work. I don't know what I'm doing wrong. Maybe somebody can explain a simple, rudimentary way to carry out this task.
Here's the custom code in php:
$Sub = $NewForm->Sub;
$Subcalc= $Sub/100;
$NewForm->Sub = $Sub;
Essentially, I'm having trouble understanding how to associate html forms and php variables. I tried to do this using SQL but that's even more crazy. Can anyone please help me?
Thank you in adavance.
|
 |
 |
klwillis
Posts: 428
|
| Posted: 09/05/2007, 3:23 PM |
|
Try this instead:
$Sub = $NewForm->Sub->GetValue();
$Subcalc= $Sub/100;
$NewForm->Sub->SetValue($Subcalc);
Quote CodeChargenewbie:
First, as my name dictates, I'm a bit of a newb at this program -- I started using it about 1 1/2 weeks ago.
Here's what I want to do (please don't take offense to my dumb-it-down approach):
I have a Record page. There's a label on the page called Sub. The label's control source is also called Sub, which belongs to a table in a database. When this page is displayed, a value will be written into the label, governed by Sub. Now what I want to do is take Sub and divided it by 100 and display it in the same label. That is, take a value from a table, dviide it by 100, and then display ithe result in the label.
I tried adding custom code in javascript and the label didn't display anything. I then tried php and it also didn't work. I don't know what I'm doing wrong. Maybe somebody can explain a simple, rudimentary way to carry out this task.
Here's the custom code in php:
$Sub = $NewForm->Sub;
$Subcalc= $Sub/100;
$NewForm->Sub = $Sub;
Essentially, I'm having trouble understanding how to associate html forms and php variables. I tried to do this using SQL but that's even more crazy. Can anyone please help me?
Thank you in adavance.
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"
Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006 |
 |
 |
datadoit.com
|
| Posted: 09/05/2007, 6:19 PM |
|
klwillis wrote:
> Try this instead:
>
> $Sub = $NewForm->Sub->GetValue();
>
> $Subcalc= $Sub/100;
>
> $NewForm->Sub->SetValue($Subcalc);
>
--------------------------
or just:
$NewForm->Sub->SetValue($NewForm->Sub->GetValue()/100);
|
|
|
 |
CodeChargenewbie
Posts: 114
|
| Posted: 09/06/2007, 5:50 AM |
|
Awesome. Both worked. Thank you!
Now if I wanted to modify it to round down to the nearest integer, where it reads GetValue()/100, can I say floor(GetValue() / 100)?
|
 |
 |
|