No announcement yet.

Convert positive value to negative

  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert positive value to negative

    When entering records into a form, I want to enter positive values and store that value in the database.

    When I display those records in a grid, I want to see negative values if the transaction type is "withdraw" (for display / total purposes only).

    I thought I could use the "onrecord" event to convert the value (in a 2nd field) to be negative using something like this: {amount_conv} = -{amount};

    I can do it on the form if I make 'amount' a variable and put that variable -{amount} in the "store in database field" for the value 'amount_conv'. But that only works when I add a record; doesn't work when I change a record. (That's what you see on this screenshot) .. sounds convoluted to me.

    It doesn't work. Maybe I'm going about it all wrong (new to sc). Any ideas?
    Attached Files

  • #2
    I got it. Must have done something wrong. It is what I thought it should be:

    Grid > OnRecord / {amount_conv} = -{amount};