Trying to calculate a field based on other answers

Trying to calculate a field based on other answers

bfarkasbfarkas Posts: 181Questions: 48Answers: 0

Hi,
I am new to this and trying to work through a solution.
My goal is to have users enter data and have two fields hidden on the form.
Based on other answers a user puts while filling out the form, these first two fields will get values added.
I am thinking this is mostly math, as the first field can be straight multiplication with a value assigned to each drop down to figure out its value, and then the second field will just display text based on the first value.

I have the basics of the table setup, trying to figure out how to approach this piece:
https://newyorklife.acms.com/nestfinder/

Any advice is greatly appreciated.

Thanks,
Brian

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    edited December 2019

    Are you using Editor for the editing? If so, there are examples there on how to modify other fields, either on the client or the server, based on the value of other columns.

    If not, you can just use columns.render,

    Colin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    I am using editor, This is a little more complex than the examples as I want o take into account a few columns to determine the value

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    A few columns wouldn't complicate it too much. If you want to do the changes on the server, this would help. If not, please could you provide more details and code, please.

    Colin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Hi,
    I am doing this entirely front end, do not have a server resource to connect it to.
    Here is the link to my current working process:
    https://newyorklife.acms.com/nestfinder/
    Pick the "NEST FInder Tool from the navigation to get to the table.

    Here is the goal.
    Currently you can fill in entries, the first two columns of the table should have values that calculate based on what the user selects elsewhere. My goal is to basically do a multiplication, so that the first column is essentially a number that orders biggest to smallest.

    I am waiting to get the values from a different team to apply to the drop down menus, but essentially, any non-open ended question will have a value for each choice, which when you multiply across gives you a value for column one, and then based on this value, text is inserted into column two.

    Thanks,
    Brian

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Hi @bfarkas ,

    If it's stored local in the table, you can do something like this: http://live.datatables.net/kunijivo/1/edit . That's manipulating the table on each draw to show the correct rank (here's it's the age column doubled).

    If the rank is stored in the DB, you would use the Editor events, such as preSubmit to change the data before it's sent to the server.

    Colin

This discussion has been closed.