Calculating Remainders

akrayenhagen9721
Community Member Posts: 23
Okay Ladies and Gents,
I'm asking for help once again, as I am not proficient in JavaScript. Here is my dilemma, I am trying to do math in Lectora and output answers based on the answer. But the problem is that I can't figure out how to calculate the remainder. Attached you will see an image of the calculations being performed.
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).
Can anyone help me?
I'm asking for help once again, as I am not proficient in JavaScript. Here is my dilemma, I am trying to do math in Lectora and output answers based on the answer. But the problem is that I can't figure out how to calculate the remainder. Attached you will see an image of the calculations being performed.
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).
Can anyone help me?
Comments
-
-
Questions like these i often use to improve my own portfolio. This time again.
http://community.trivantis.com/shared-content/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...
Categories
- 4.7K All Categories
- 3 New Feature Releases
- The Training Arcade®
- Arcades™
- 57 ✫ Announcements
- 6 ✪ Contests
- 34.1K eLearning Brothers® Products
- 33.6K Lectora®
- 31.5K Lectora Discussions
- 1.9K Lectora Feature Requests
- 64 Lectora User Groups
- 16 Asset Library
- 10 AssetLibrary Discussions
- 6 AssetLibrary Feature Requests
- 293 CenarioVR®
- 171 CenarioVR Discussions
- 122 CenarioVR Feature Requests
- 29 Rockstar Learning Platform®
- 20 Rockstar Learning Platform Discussions
- 9 Rockstar Learning Platform Feature Requests
- 4 Off-the-Shelf Course Library
- 3 Off-the-Shelf Course Library Discussions
- 1 Off-the-Shelf Course Library Feature Requests
- 114 CourseMill®
- 107 CourseMill Discussions
- 43 ReviewLink®
- 31 ReviewLink Discussions
- 12 ReviewLink Suggestions
- 2 The Training Arcade®
- 1 The Training Arcade Discussions
- 1 The Training Arcade Feature Requests
- 10 Additional Learning Products
- 2 Adobe®
- 4 Articulate®
- 2 Camtasia®
- Docebo®
- 1 iSpring®
- 1 Microsoft® PowerPoint®
- 912 All Things eLearning
- 5 Course Development Showcase
- 1 eLearning Brothers® Downloads
- 1 Compliance Training
- 11 eLearning Development
- eLearning Game Design
- 7 Instructional Design
- 545 Learning Management System (LMS) Integration
- 2 Mobile Learning
- 5 Visual Design
- 329 Web Accessibility
- 1.2K ♪ The Green Room
- 7 ♡ Community Feedback
- 7 Community Tips