# Problems with Reverse Calculation

## Recommended Posts

I have a calculation that goes like that, I input a number on "Base Imponibile" (say 100), it adds 15% (it gets me 115), it then calculates 4% to the previous result (115) and it gets me 4,60, I then add 2 and the total is 121,60 which is perfect.

And that's the part that works just fine. But I then want to make a reverse calculation, where I input the expected result of Total Calculation and tells me all the other values and here it's where things go awry.

Quote

Input Field of Total Calculation:
121,60

Calculation 2 removes 4% from the previous field => (wTotale-(wTotale*100/104))
4,68 (and here it is the first error, it is supposed to return 4,60)

Calculation 1 calculates 15% of the yet unknown "Base Imponibile" field => (wTotale-wCPA)-wBaseImponibile
16,74 (and here it ss the second error, it is supposed to return 15,00)

Calculation 3 it is supposed to calculate the last value "Base Imponibile" => wTotale-2-(wTotale-(wTotale*100/119))
100,18 (and here it is the third error, since it is supposed to return 100,00)

I'm attaching the initial calculation that works as a reference and the reverse calculation which doesn't work as an example. The "2" that gets subtracted in the reverse calculation is a fixed value of a small tax that I have to deduct (imposta di bollo).

I have a feeling that the reverse calculation goes crazy because of some unwanted rounding somewhere, but I am not to sure, so I seek the opinion of more calculation versed persons around.

##### Share on other sites
44 minutes ago, Mafia2020 said:

I then want to make a reverse calculation, where I input the expected result of Total Calculation and tells me all the other values

Consider:

```Let ( [
a = Input - 2 ;
b = a / 1.04 ;
c = a - b ;
d = b / 1.15 ;
e = b - d
] ;
List ( a ; b ; c ; d ; e  )
)```

With Input = 121.6, this returns:

```119.6
115
4.6
100
15```

• 1
##### Share on other sites
2 hours ago, comment said:

Consider:

```

Let ( [
a = Input - 2 ;
b = a / 1.04 ;
c = a - b ;
d = b / 1.15 ;
e = b - d
] ;
List ( a ; b ; c ; d ; e  )
)```

With Input = 121.6, this returns:

```

119.6
115
4.6
100
15```

This returns the exact numbers I need to get and it seems a much more elegant solution than the faulty one I devised. Only, I was wondering, can the LIST part be delegated to single fields instead of having one big field with all the results? So for instance have a field that lists separately A, B, C, etc taking the input from the previous calculation with the LET function? Otherwhise instead of getting for instance

Quote

100,00
15,00
4,60

I get this

Quote

100154,60

Also, for some reasons I can tell FM to add the mandatory 2 decimals only for the last number while the first two results are 100 and 15 rather than 100,00 and 15,00

Edited by Mafia2020
##### Share on other sites
17 minutes ago, Mafia2020 said:

can the LIST part be delegated to single fields

Of course it can. The list was just a convenient way of showing how to calculate all parts at once. You can easily split this to individual fields - for example:

```Let ( [
a = Input - 2 ;
b = a / 1.04
] ;
a - b
)```

will return 4.6 in your example.

Edited by comment
##### Share on other sites
2 hours ago, comment said:

Of course it can. The list was just a convenient way of showing how to calculate all parts at once. You can easily split this to individual fields - for example:

```
Let ( [
a = Input - 2 ;
b = a / 1.04
] ;
a - b
)```

will return 4.6 in your example.

Thank you for your patience and pointers, it now works exactly as I intended to.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Similar Content

• By fousthvk
Does anyone know how to do this? calling the "generate as configured" script stacks the script that gets called after the webveiwer is set at the end of the primary script, there for only the last record in the found set of the loops actually has the image file created and saved to the container field.
• By bgscott
Recently converted a FM application from V6 to V19.  The application will run on FM server.  Very new to FM19
Questions related to temporary path
I have scripts that exports data to 3 temporary fm12 files.  Two of the temp files hold data that is them imported to other files and one of the temp files holds data for a lookup in another file.
dhistory imports data from dtemp
rhistory imports data from rtemp
vendors looks up data from vtemp
The temp files are fm12 files
Questions
1.  I would like to have the temp files sent to the temporary path on the users computer.  I have not been able to correctly specify the output path to send the temporary files to the temporary folder on the users computer.  This is one attempt: get(temporarypath) & dtemp but this does not sentd the file to the temporary folder
2.  Once I get the correct syntax to save the temporary files in the temporary folder, how do I tell the import records script step where to find the temporary files?  What is the correct way to point to the file so it would work on any users computer?
3.  Vendors file performs a relookup in vtemp, so I need a relationship between vtemp table, located in temporary folder, and vendor table.  How do I specify the location of vtemp so it can be found on any users computer?
Once the script finish running the temporary files are no longer needed and it is my understanding that the temporary files will be deleted when the Filemaker session is closed.
• By milky
Hi All,
Just had a look at the new Add-ons in Fm19.
Is there a way to make the timer work in reverse.
i.e. Start from a field (Timer::TimeLength) that a user can input, so that the specified time of say 30:00 will run down to 0:00
Any help would be appreciated.
Regards

Milton.
• By BostonFM
I am trying to script an import of three worksheets in the same Excel file. The 3 geographical regions worksheets are not structured the same, i.e. field name rows are not in the same place and are named differently.
The script runs but stops to ask which worksheet to process.
How do I create a variable/parameter in the script for it to proceed sequentially from worksheet 1-3 without stopping?
Thanks
DA

• Hello Fellow FM'ers!
We have been testing Linux and everything has been great, but we are having issues with the authentication via web direct using Windows Federated Services. We followed the steps in the available documentation "Addendum4_ADFS.pdf" and also used "ExtendOAuth_v1.pdf" to get the AD-FS rules configured as well as the necessary admin console requirements (Client Key, Shared Key etc...) We do see the following on attempting to login to our solution:

And when we click on the AD FS Option we do receive a login prompt from our Federated Services:

However, even with the correct credentials we still see the following error message:

We have reviewed the logs within AD-FS and no errors are reported and the credentials are passed as expected. Within our solution and Active Directory, we also ensured the user is in the correct group to access our solution via webdirect. I will gladly provide more details into the configuration of AD-FS or FM Admin Console, but these all match the documentation provided by Claris.
We went a bit further and got an inhouse developer to take a look and test the flow and he was able to confirm the following:
Our Endpoints are setup correctly and can be viewed internally @"https://INTERNALADFS/adfs/.well-known/openid-configuration" Initial request  was tested with "https://oidcdebugger.com/"  Postman was then used to test once we received a response. Decoding the jwt received with "https://jwt.ms/"
The JWT had a unique_name, an email, and a groups array with one of the values in that group array being the group that is set up in the Filemaker solution.   With that said, we are not sure what the next step would be to test this as we appear to be seeing all the correct information in our testing yet we still are not being "authenticated" in our solution. I have also opened a ticket with FIleMaker and no luck as of yet. Any insight would be greatly appreciated!
• ### Who Viewed the Topic

10 members have viewed this topic:
Kitthawkp40  Rich M  TMC09  Ron Cates  rwoods  doughemi  Steve Martino  Aussie John  Lee Smith  Rick Whitelaw
×
×
• Create New...

## Important Information

By using this site, you agree to our Terms of Use.