- Регистрация
- 16.09.2018
- Сообщения
- 6
- Реакции
- 0
- Баллы
- 1
Hi,
The more I play around with Zennoposter, the more I think it's awesome.
I'm facing a problem though, which is probably simple to solve for most but not for a newbie like me, especially since I don't have any programming skills. Maybe someone could help me overcome this issue. Thanks in advance.
Goal:
Calculate the average of a sum on the fly.
The data I have
In my source table I have a list of prices I collected for products. I could be one price or up to 4 (which is the maximum number of prices), it changes from line to line. Here is an example:
[TABLE="class: brtb_item_table"][TBODY][TR][TD]Product 1[/TD][TD]100[/TD][TD]104[/TD][TD]97[/TD][/TR]
[TR][TD]Product 2[/TD][TD]247[/TD][TD]238[/TD][/TR]
[TR][TD]Product 3[/TD][TD]1207[/TD][TD]1187[/TD][TD]1193[/TD][TD]1282[/TD][/TR][/TBODY][/TABLE]
I'd like, for each line, get the average.
For example, for product 1: (100+104+97)/3=100,33
How I see the problem
Parsing is not really an issue. What is a problem for me is doing the math (since I don't know javascript, I'm not 100% of what piece of javascript code to look for and what I've searched around doesn't answer my question).
I understand that I can use javascript in the project for basic math, such as {-Variable.Product1-}+{-Variable.Product2-} or ({-Variable.Product1-}+{-Variable.Product2-})/3
However I can't add more than two variables like {-Variable.Product1-}+{-Variable.Product2-}+{-Variable.Product3-}. It doesn't work.
I could of course try:
Just to let you know, here is how I plan to parse the original data
So I have this table you saw above with the products in a .xlsx file.
In Zennoposter, I plan to do the following actions:
The more I play around with Zennoposter, the more I think it's awesome.
I'm facing a problem though, which is probably simple to solve for most but not for a newbie like me, especially since I don't have any programming skills. Maybe someone could help me overcome this issue. Thanks in advance.
Goal:
Calculate the average of a sum on the fly.
The data I have
In my source table I have a list of prices I collected for products. I could be one price or up to 4 (which is the maximum number of prices), it changes from line to line. Here is an example:
[TABLE="class: brtb_item_table"][TBODY][TR][TD]Product 1[/TD][TD]100[/TD][TD]104[/TD][TD]97[/TD][/TR]
[TR][TD]Product 2[/TD][TD]247[/TD][TD]238[/TD][/TR]
[TR][TD]Product 3[/TD][TD]1207[/TD][TD]1187[/TD][TD]1193[/TD][TD]1282[/TD][/TR][/TBODY][/TABLE]
I'd like, for each line, get the average.
For example, for product 1: (100+104+97)/3=100,33
How I see the problem
Parsing is not really an issue. What is a problem for me is doing the math (since I don't know javascript, I'm not 100% of what piece of javascript code to look for and what I've searched around doesn't answer my question).
I understand that I can use javascript in the project for basic math, such as {-Variable.Product1-}+{-Variable.Product2-} or ({-Variable.Product1-}+{-Variable.Product2-})/3
However I can't add more than two variables like {-Variable.Product1-}+{-Variable.Product2-}+{-Variable.Product3-}. It doesn't work.
I could of course try:
- {-Variable.Product1-}+{-Variable.Product2-} then assign result to variable (say {-Variable.Result1-})
- {-Variable.Product2-}+{-Variable.Result1-}/3
Just to let you know, here is how I plan to parse the original data
So I have this table you saw above with the products in a .xlsx file.
In Zennoposter, I plan to do the following actions:
- assign the file to a table
- call a line of the table (order doesn't matter) and delete it after taking it
- assign the cells to a variable
- create a List and add one variable (price) per row
- do row count on the List to get the divider (to divide the sum of prices to get the average) and assign it to a variable (say {-Variable.Divider-}
- do the javascript math (my problem)