So lets say that I have a ceiling of 120. In line one I want to request 50 seats. So it should look like this…
Req/Rel | Enter Seats | Total Req | Total Rel | Total Aloc | RH Aloc | RH Avail | RHREA Req | RHREA Rel
Req 50 2 0 120 48 48 2 0
So as you can see, we are requesting 50 seats (Enter Seats), but with a ceiling of 120 seats (Total Aloc) that leaves 2 seats left (RHREA Req) to be held because there are only 48 available seats (RH Aloc | RH Avail).
I am planning to improve this setup and add animations for the elements to it, but thats for a next version. This version for now shows how to handle a calculation for remaining amount quite fine.
What you need to learn to use it…
– How to read variables from Lectora -> VarEntry_0001.getValue()
– How to write variables to Lectora ->VaramountOfAvailableSeats.set(endResult);
– How to use if/then statements to make a check and do something -> lines 18-30
– How to target elements in Lectora -> in this case getHTMLNamesFromLectora() gets all seats in an Array to handle it. Quite a few different options for that shown in the forum here. This option is good when you have masses of images to handle and want to get it done without having to bother about their HTMLName. For now there are 24 seats in this aircraft. I am gonna add more, so then this function comes handy.
– How to target a Group in Lectora -> runGroup_og18013()
– How to calculate -> endResult = Number(amountOfAvailableSeats) – Number(amountOfSeatsRequested);
Lectora variables are strings. So you have to make numbers of them before you do any calculation.