Hi Everyone!! I am trying to create a Value Z = Value A + Value B1 + Value B2 + (Value C1*Value C2*…) system. Value A: To be filled in a text box. Value B: To be selected using a dropdown box. Dropdown box options come from a list view that can be updated by the admin or user Value C: To be selected using a checkbox (reference set selector). The options also come from a list view that can be updated by the admin or user, and multiple values can be selected. Currently, My app is able to run. However, the calculation is wrong. Only the bolded part of the equation is working. Value Z = Value A + Value B1 + Value B2 + (Value C1*Value C2*…) In the photo below, I have created a new integer variable which i defined as 1. However, I created a loop to connect it to the selected Values C and change it's variable. Nonetheless, the value still remains the same, as 1. So instead, the formula is working in this way Value Z = Value A + Value B1 + Value B2 + 1 instead. could someone help me with this? And if you are wondering if i had tried to commit it, yes I did, but it still didn't work.
asked
Nur Fadhilah Binte Mohamad Noor
1 answers
0
I think the steps to take are the following:
Initialize a variable (e.g., productOfC) to 1 before the loop starts.
Loop through each of the selected Value C items.
In each loop iteration:
Multiply productOfC by the current Value C item's value.
Assign the result back to productOfC.
After the loop, productOfC will be the product of all selected Value C items.
Update your Value Z calculation to: Value Z = Value A + Value B1 + Value B2 + productOfC