Hi, I currently have three fields:
- remaining_funds
- hourly_rate
- remaining_time
Field 1 and 2 are currency fields. Now the logic behind this is I want to add remaining funds and the hourly rate. This should then divide remaining funds by the hourly rate and calculate the remaining time. The problem is if i try to write a server script with the following syntax:
doc.time_remaining = doc.funds_remaining / doc.hourly_rate
it gives me a parser error. Any help is appreciated.
Also, I tried working around this with the following mindset. I changed all three Fields to float values. Then implemented a while loop to convert remaining funds to remaining hours.
The syntax for which is:
// remaining funds = a
// hourly rate = b
the rest of the variables below I also created as fields and made as hidden and read only.
doc.c = doc.a / doc.b;
doc.i = 0.0;
while(doc.i < doc.c){
doc.i = doc.i + 1.0;
}
doc.j = doc.c - doc.i;
doc.k = doc.j * 60;
print doc.i; // for hours
print doc.k // for minutes
However when I use a while loop or attempt to manipulate the fields (float type) as normal python variables, it gives me a syntax error. Am i missing something here? Also I am writing all this as a server script