AnsweredAssumed Answered

Obtaining a value and calculation a result

Question asked by andy@the-wod.co.uk on Feb 23, 2012
Latest reply on Feb 23, 2012 by RayCologon

I have:

 

Client records

Purchase orders (in addition to the total number of session purchased I am displaying a list of "session records" related to each purchase order)

Session records (I provide services by the hour purchased in bulk by client)

 

I have got this far:

 

I create a client record

I can then create a purchase order

I can then create a session record that will pull in a list of clients who have a purchase order, select from that list a client and then select a purchase order associated with that client. I can display the total number of sessions purchased from the purchase order in a field on the session record

 

Currently I am then manually entering the current session number into the session record

 

What I would like to happen is:

 

on selecting a purchase order number and exiting the select purchase order number field run a calculation/if statement that will carry out the following action

 

1. evaluate the total sessions purchased from the purchase order record

2. obtain the last current session number on the current purchase order record (on the purchase order record there is a list of all session records related to that purchase order, the list displays the current session number for each record)

3. check that current session number is less than the total sessions purchased

4. if true than add "1" to the value in current session number and place that value into the field current session number in the current session record and move to the next field

5. if false then maybe provide a means of displaying a dialogue saying "select a different order or purchase more sessions"

6. if ["select a different purchase order"] then go to the field select customer order number where an alternative purchase order can be selected

7. if ["purchase more sessions"] then got to layout [purchase orders] to create a new purchase order

 

 

What I would like help on is:

Is below the basis of the if statement?

Can I display a dialogue?

How do I get the value form the last line in the list field?

 

Here is my feeble attempt at the if statement so far :-(

 

if (total sessions purchased) > (current sessions number) then take the "current sessions number" from the last session on the current purchase order and add "1" to value, take this value and place it into the field (current session number) of the current session record

end if

or

if (total sessions purchased) = (current sessions number) by taking the "current sessions number" from the last list line on the current purchase order then [display a dialogue that says "select a different order or purchase more sessions"

if ["select a different order"] then go to the field [select customer order number]

end if

else

if ["purchase more sessions"] then got to layout [purchase orders]

end if

end if

 

Thank you for any help possible.

 

Andy

Outcomes