0

link choice

Hello everyone.
I'm stuck for something stupid, but I can't find the solution. If someone could help me?
Thanks in advance.

 

Here is my little problem.
I created a "Devise" sub-table with different information in my "Paramètres" section.

 

In my "Articles" table, I refer to my "Devise" (A) table via a "dynamic field" (A) allowing me to choose the currency used by a supplier. On this side there is no problem.

Now I would like the "formula fields" « Prix d’achat Net (HTVA) & Prix d’achat Net (TVAC) » to take into account the exchange rate indicated in my "Devise" table according to the selection I made via the "currency dynamic fields"

 

Currently, the calculation is good, but it does not take currency into account.

In this case, the formula is:

    Purchase price - discount      i.e.      5.99$ - 17% = $4.97 and not €

I would therefore have to multiply the result by the exchange rate indicated in my "Devise" table and selected by the dynamic field "Devise"

    So =>> Purchase price - Discount * Rate      i.e.      5.99$ - 17% * 0.94 = €4.67€

 

I can't find how to use the "Taux" linked to the "Device"

2 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    When using dynamic fields you will be using the record() command to get data from the choice in the dynamic field.

    Try something like:

    let t := this;
    let selection := record(Device,number(t.Device))
    ('Prix d’achat Brut (TVAC)' - 'Prix d’achat Brut (TVAC) * Remise/100) * selection.TAUX
    

    Since you have a dynamic field, when you use number() you get back the record Id of the selection so you can use the record() command to get the data of the specific record that you selected. Then you can reference any field that is in that record.

    I'm not sure you will need line 1 and the reference to it in line 2. I threw it in there because the table name and the field name are exactly the same. You can try it without it and if Ninox doesn't freak out then you should be good to go.

      • Didier_Schoonjans
      • 1 yr ago
      • Reported - view

      Fred 

      Thanks for your help @Fred

      That's right, line 1 and its reference in line 2 are not necessary.
      It works fine without it.
      Thank you again for your efficient intervention.

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 2Replies
  • 71Views
  • 2 Following