Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple Calculation does not perform as expected.

Featured Replies

Hi, I have what should be a easy question to answer.

What does "Evaluate this calculation from the context of: TableName" mean?

I would understand this to mean perform this calculation using this TableName and related tables.

The only problem is if the TableName is not related to the TableName used by the current layout, the "context" is unavailable. As a result, I fail to see the point, and do not understand how to accomplish these "isolated" calculations.

Thanks to anyone who might have some insight into this problem.

Bill

Calculations are added into tables. They usually evaluate from the first occurrence created (and named) which is usually the primary occurrence. But if you have another table occurrence of the same table off somewhere else in your graph which has related tables, you can specify the calculation to go 'stand' on THAT occurrence and perform its evaluation.

So if you have a table occurrence group which consists of of Current_Customers (customers table) and it has related Sales_Rep (staff table) then you can write a calculation which makes this evaluation look at this relationship to grab the information without you having to create a Sales_Rep (staff table) and attach it directly to your original customers table occurrence.

You can have two calculations which each are evaluated from different table occurrence groups but, because their perspective is different, you will end up with different calculation results.

If you wish to provide a specific situation(and a copy of your graph or a sample file), we could show you more specifically what we mean. :smile2:

  • Author

Thanks for replying so quickly.

Currently, I am attempting to setup a self-maintaining serial number field. I am trying to use a summary field to give me the current maximum value and then add one.

The problem is I rarely have access to the same table occurrence, and as a result the summary field comes back empty. If I am to able to specify the context that is always used, this would work.

It would appear that I attempting to use this in a different way then it was intended be used.

Bill

"I am attempting to setup a self-maintaining serial number field."

Don't go there. Use FM's auto-enter serial numbers.

  • Author

Yes, I am finding that out.

But, it would still be nice to completely isolate a calculation. Oh well.

Thanks for the help.

Bill

Yes, I am finding that out.

But, it would still be nice to completely isolate a calculation. Oh well.

Thanks for the help.

Bill

What does it mean to you to "isolate a calculation"?

Also, are you performing this calc in a script or a field definition? If this is a field definition, then the context is available to you. There really is no problem here.

  • Author

Actually, I was looking for a way to calculate a value based only on the table. No matter which script was running, mostly having to do with the summaries of all records.

I find it useful to have these independent calculations, for now I have I written scripts which act as "functions" and return the value. But it would more efficient, I think to have this in the table design.

Who knows, maybe this will be in a future version.

Bill

Actually, I was looking for a way to calculate a value based only on the table. No matter which script was running, mostly having to do with the summaries of all records.

I find it useful to have these independent calculations, for now I have I written scripts which act as "functions" and return the value. But it would more efficient, I think to have this in the table design.

Who knows, maybe this will be in a future version.

Bill

Well, that doesn't help much. What are you really trying to do? Can you give a concrete example or post an example file? So far I haven't heard anything that can't be done right now.

The only problem is if the TableName is not related to the TableName used by the current layout, the "context" is unavailable. As a result, I fail to see the point, and do not understand how to accomplish these "isolated" calculations.

The "Evaluate this calculation from the context of: [___]" parameter applies ONLY to related values referenced in the calculation.

To give a somewhat arbitrary example, suppose you have two tables with two relationships between them:

Table A::Firstfield = Table B::Firstfield

Table B::Secondfield = Table A 2::Secondfield

A calculation field in Table A defined as =

List ( Table B::Thirdfield )

will return a list of values from records in Table B related by Firstfield, when evaluated from the context of Table A. If the same calculation is evaluated from the context of Table A 2, it will use the second relationship and list only records that are related by Secondfield.

But an "isolated" calculation using only local fields, such as:

Somefield + 5

will always return the same result, no matter from which context.

  • Author

Ok, I see where the confusion is.

By "isolated" I wasn't referring to just something like: Somefield + 5, or even Somefield1 + Somefield2.

But rather: Somefield1 + Summaryfield1, from the same table.

I have feeling this is where I am having the problem, with Summaryfield being always reevaluated based on the current context.

Bill

Summary fields summarize the found set. Each TO can have it's own found set (actually, several found sets, if you have more than one window open), so this calculation is definitely depending on the context.

If you want a summary that ignores the found set, you need to define a self-join relationship using the = relational operator, and summarize the related records.

  • Author

This does look like what I have been looking for.

Does it matter what type of field I use for the self-join relationship (Global, etc.)?

Thanks,

Bill

No.

  • Author

Ok, thanks it does appears this solves my problem.

Thanks Again,

Bill

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.