#391954 Score: 0
Profile photo of Math Notermans
Math Notermans
Member
contributor
intermediate
advanced
friend finder
junior moderator
advocate
LUC16 Attendee
LUC16
wise owl
curious george
129 pts
@mnotermans5114

Questions like these i often use to improve my own portfolio. This time again.

Seats Calculator


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.
Only thing you really need from it is parts of the ‘ReserveSeats’ function in the external Javascript.
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.

Well i do hope this helps you on the right track…