We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to do the sum of objects taken from csv

Home Forums Puzzles How to do the sum of objects taken from csv

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #66406
    giorgioz
    Customer

    Hello

    I’m trying to make a price calculator to read values from a local csv file and than doing the sums of the prices.
    Right now the final_cost is reading correctly the values from the .csv gile but looks like i’m not able to do the sum
    What should i insert into the price_recount puzzle in order to have package1+package2?

    Thanks!

    • This topic was modified 1 year, 2 months ago by giorgioz.
    Attachments:
    You must be logged in to view attached files.
    #66411
    kdv
    Participant

    But if you have more than two items in your list then it’s better to use a loop.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #66413
    giorgioz
    Customer

    http://prntscr.com/m8VBnG0As_mK

    if i use this than the final_cost is showing the single values, not the sum
    am i doing something wrong?

    thanks for the help!

    • This reply was modified 1 year, 2 months ago by giorgioz.
    #66416
    kdv
    Participant

    am i doing something wrong?

    Exactly.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #66429
    giorgioz
    Customer

    Thanks! This is working correctly now

    What i have to do is creating a sum of multiple object that follow more or less this logic:
    Starting price 1$ + accessory1+ accessory2+accessory3+accessory4 etc…
    You can add different objects that will keep stacking the sum (you can toggle on and off the objects)

    You were mentioning that using a loop is the best option, how can i use it in the best way?
    Thanks a lot man!

    #66433
    kdv
    Participant

    Create a correct .csv like this

    accessory1_name_as_in_3D_editor;price1
    accessory2_name_as_in_3D_editor;price2
    accessory2_name_as_in_3D_editor;price3

    Use a loop to search for visible objects in this pricelist and sum their prices.

    How to work with .csv using a loop

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.