0

Set another field's value from calculation?

Is it possible to set another field's value (in the same table) from a calculation? I haven't been able to do it. The calculation would also set its own field's value.

If I have calculated field and I try to set another field with the calculation's result, nothing happens.

Can't find anything documented or examples.

Possible?

Thx,

8replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Fred
    • Fred
    • 4 mths ago
    • Reported - view

    What is your code?

    Like
      • Mike
      • ninox.1
      • 4 mths ago
      • Reported - view

      Fred I have a calculation field called 'calcwt' and another regular text field called weight.

      Inside the calcwt field, I calculate the decimal pounds + ounces entered like this:

      let i := wt_pounds + wt_ounces/16

      I'd then like to take that value and populate the regular 'weight' text field with it.

      That is, assign the calculated value, i, both to the calculated field itself, but also to the other text field.

      My issue is trying to convert a small application to Ninox. Some of the conversions from pounds and ounces were done in a completely different way in the other DB.

      Does that help?

      P.S. Does Ninox have a comment symbol for scripts?

      Like
  • Textfield := text(Formulafield)

    Or

    Numberfield := number(Formulafield)

    A trigger with a button is needed.

    Like 1
      • Mike
      • ninox.1
      • 4 mths ago
      • Reported - view

      RoSoft_Steven Rooryck If I go into the formula field and type:

      weight := text(this)

      I get the message that "This formula may not modify data."

      That's the error I got before.

      I may have the context for my code incorrect?

      Thanks

      Like
    • Fred
    • Fred
    • 4 mths ago
    • Reported - view

    Yeah, formula fields can't modify other fields. They can only do functions to get data.

    As Steven says, you either have to

    1. use a button
    2. put it in On Click for the formula field
    3. put it in Trigger after update at the Table level

    All you need at this level is:

    weight := calcwt
    
    Like 1
      • Mike
      • ninox.1
      • 4 mths ago
      • Reported - view

      Fred You guys are great. Thanks!!! :)

      Like
      • Alan Cooke
      • Alan_Cooke.1
      • 3 mths ago
      • Reported - view

      Mike To comment simply surround the line with:

      "this is  a comment";

      next line

      Like 1
      • Mike
      • ninox.1
      • 3 mths ago
      • Reported - view

      Alan Cooke Thanks Alan. I was searching all over for the "//" or the "#" or other preceding comment symbol like in programming languages. I couldn't find anything in the manual. A simple quote never occurred to me. :)

      Like
Like Follow
  • 3 mths agoLast active
  • 8Replies
  • 73Views
  • 4 Following