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.

Calculate field value list

Featured Replies

  • Author

Hi

I am still pretty shaky in the area of calculations and the limits of what they can do. I'm wondering how to go about calculating a list of related values from another table field. I'm not sure if there is a way to loop through the values, or if I'll have to create a recursive function somehow...

Seems like if there is a way to write a loop, I could just run a loop with lookup(), but I dont think there is a way to loop in a calculation field.

Any suggestion? I really don't quite know where to start with it.

Also, I know somebody will probably suggest that I just create a value list on the related field, but my problem is that I need to be able to generate lists from different tables, not just one. So, I am pretty sure I have to calculate it, because the source field is variable.

Hi

I am still pretty shaky in the area of calculations and the limits of what they can do. I'm wondering how to go about calculating a list of related values from another table field. I'm not sure if there is a way to loop through the values, or if I'll have to create a recursive function somehow...

Seems like if there is a way to write a loop, I could just run a loop with lookup(), but I dont think there is a way to loop in a calculation field.

Any suggestion? I really don't quite know where to start with it.

Also, I know somebody will probably suggest that I just create a value list on the related field, but my problem is that I need to be able to generate lists from different tables, not just one. So, I am pretty sure I have to calculate it, because the source field is variable.

  • Author

Hi

I am still pretty shaky in the area of calculations and the limits of what they can do. I'm wondering how to go about calculating a list of related values from another table field. I'm not sure if there is a way to loop through the values, or if I'll have to create a recursive function somehow...

Seems like if there is a way to write a loop, I could just run a loop with lookup(), but I dont think there is a way to loop in a calculation field.

Any suggestion? I really don't quite know where to start with it.

Also, I know somebody will probably suggest that I just create a value list on the related field, but my problem is that I need to be able to generate lists from different tables, not just one. So, I am pretty sure I have to calculate it, because the source field is variable.

My question is sufficiently similar it seemed appropriate to post it here - if not I apologize.

I want to enter a start date and a number of days and generate a return-delimited list I can operate on, thusly:

Date: January 1, 2005 ; Days: 5 =

1/1/05

1/2/05

1/3/05

1/4/05

1/5/05

this seems like it ought to be trivial AND common, and yet I have searched all over without success.

any help would be MUCH appreciated. (we have Developer, so could create custom function if necessary)

My question is sufficiently similar it seemed appropriate to post it here - if not I apologize.

I want to enter a start date and a number of days and generate a return-delimited list I can operate on, thusly:

Date: January 1, 2005 ; Days: 5 =

1/1/05

1/2/05

1/3/05

1/4/05

1/5/05

this seems like it ought to be trivial AND common, and yet I have searched all over without success.

any help would be MUCH appreciated. (we have Developer, so could create custom function if necessary)

My question is sufficiently similar it seemed appropriate to post it here - if not I apologize.

I want to enter a start date and a number of days and generate a return-delimited list I can operate on, thusly:

Date: January 1, 2005 ; Days: 5 =

1/1/05

1/2/05

1/3/05

1/4/05

1/5/05

this seems like it ought to be trivial AND common, and yet I have searched all over without success.

any help would be MUCH appreciated. (we have Developer, so could create custom function if necessary)

If the number of days is not a constant (or cannot be limited to a predefined maximum), you need a custom function. See

here .

If the number of days is not a constant (or cannot be limited to a predefined maximum), you need a custom function. See

here .

If the number of days is not a constant (or cannot be limited to a predefined maximum), you need a custom function. See

here .

A calculation, recursive or not, cannot loop through related records, simply because there is no way to reference "related record #2". A reference to a related record in a calculation is always a reference to the FIRST related record, or, in an aggregate function, to ALL related records.

I believe your best choice is to create a value list based on the related field. If the related field is a variable, create a value list for each, then use a calculation to select the correct one.

The other option is a script, looping through the the records in the related table, comparing the current value to a temp global. If the value <> temp global, add the new value to the result, and update the temp global.

A calculation, recursive or not, cannot loop through related records, simply because there is no way to reference "related record #2". A reference to a related record in a calculation is always a reference to the FIRST related record, or, in an aggregate function, to ALL related records.

I believe your best choice is to create a value list based on the related field. If the related field is a variable, create a value list for each, then use a calculation to select the correct one.

The other option is a script, looping through the the records in the related table, comparing the current value to a temp global. If the value <> temp global, add the new value to the result, and update the temp global.

A calculation, recursive or not, cannot loop through related records, simply because there is no way to reference "related record #2". A reference to a related record in a calculation is always a reference to the FIRST related record, or, in an aggregate function, to ALL related records.

I believe your best choice is to create a value list based on the related field. If the related field is a variable, create a value list for each, then use a calculation to select the correct one.

The other option is a script, looping through the the records in the related table, comparing the current value to a temp global. If the value <> temp global, add the new value to the result, and update the temp global.

comment, i am forever in your debt

thank you!

comment, i am forever in your debt

thank you!

comment, i am forever in your debt

thank you!

  • Author

Good idea, about the value lists. Question, though.. how do I use a calculation to select the proper value list? That would solve my problem.

  • Author

Good idea, about the value lists. Question, though.. how do I use a calculation to select the proper value list? That would solve my problem.

  • Author

Good idea, about the value lists. Question, though.. how do I use a calculation to select the proper value list? That would solve my problem.

Example:

Let ( [

list1 = ValueListItems ( Get(FileName) ; "yourFirstListName" ) ;

list2 = ValueListItems ( Get(FileName) ; "yourSecondListName" ) ;

list3 = ValueListItems ( "ExternalFileName" ; "ExternalListName" ) ;

theList =

Case (

selectorField = "List One" ; list1 ;

selectorField = "List Two" ; list2 ;

selectorField = "List Three" ; list3 ;

"no list has been specified"

)

] ;

theList

)

Example:

Let ( [

list1 = ValueListItems ( Get(FileName) ; "yourFirstListName" ) ;

list2 = ValueListItems ( Get(FileName) ; "yourSecondListName" ) ;

list3 = ValueListItems ( "ExternalFileName" ; "ExternalListName" ) ;

theList =

Case (

selectorField = "List One" ; list1 ;

selectorField = "List Two" ; list2 ;

selectorField = "List Three" ; list3 ;

"no list has been specified"

)

] ;

theList

)

Example:

Let ( [

list1 = ValueListItems ( Get(FileName) ; "yourFirstListName" ) ;

list2 = ValueListItems ( Get(FileName) ; "yourSecondListName" ) ;

list3 = ValueListItems ( "ExternalFileName" ; "ExternalListName" ) ;

theList =

Case (

selectorField = "List One" ; list1 ;

selectorField = "List Two" ; list2 ;

selectorField = "List Three" ; list3 ;

"no list has been specified"

)

] ;

theList

)

I said "cannot be limited to a predefined maximum".

Otherwise, you can use a repeating field, or LeftValues ( compute a range of 2000 ; n), or any such.

Of course, I have since learned that a custom function has its own maximum of 10,000 iterations, so perhaps the difference is merely quantitative. And with up to 32,767 repetitions, repeating field looks like the winner on this one.

I said "cannot be limited to a predefined maximum".

Otherwise, you can use a repeating field, or LeftValues ( compute a range of 2000 ; n), or any such.

Of course, I have since learned that a custom function has its own maximum of 10,000 iterations, so perhaps the difference is merely quantitative. And with up to 32,767 repetitions, repeating field looks like the winner on this one.

I said "cannot be limited to a predefined maximum".

Otherwise, you can use a repeating field, or LeftValues ( compute a range of 2000 ; n), or any such.

Of course, I have since learned that a custom function has its own maximum of 10,000 iterations, so perhaps the difference is merely quantitative. And with up to 32,767 repetitions, repeating field looks like the winner on this one.

Yep, lots of ways to skin a cat.

Oops, sorry Fluffy. blush.gif

A lot of my workarounds were rendered obsolete with the Get(CalculationRepetitionNumber) function in FM7. I haven't gotten around to using it for anything yet, so I still tend to think in terms of FM6 limitations.

Yep, lots of ways to skin a cat.

Oops, sorry Fluffy. blush.gif

A lot of my workarounds were rendered obsolete with the Get(CalculationRepetitionNumber) function in FM7. I haven't gotten around to using it for anything yet, so I still tend to think in terms of FM6 limitations.

Yep, lots of ways to skin a cat.

Oops, sorry Fluffy. blush.gif

A lot of my workarounds were rendered obsolete with the Get(CalculationRepetitionNumber) function in FM7. I haven't gotten around to using it for anything yet, so I still tend to think in terms of FM6 limitations.

  • Author

Ok, comment. That little snippet worked great for fetching the list I want.

Now, I have a new problem related to that. I want to be able to show that list in a pop-up list in a field on my layout. I tried creating a fourth value list that will show the values of my field with the calculation in it. Unfortunately value lists can only be created from indexed fields, and you cannot index a calculation field that references other fields.

It's a connundrum. Is there another way to show the values in a popup besides what I was trying to do?

I'm thinking I might not be able to solve this problem at all.

  • Author

Ok, comment. That little snippet worked great for fetching the list I want.

Now, I have a new problem related to that. I want to be able to show that list in a pop-up list in a field on my layout. I tried creating a fourth value list that will show the values of my field with the calculation in it. Unfortunately value lists can only be created from indexed fields, and you cannot index a calculation field that references other fields.

It's a connundrum. Is there another way to show the values in a popup besides what I was trying to do?

I'm thinking I might not be able to solve this problem at all.

  • Author

Ok, comment. That little snippet worked great for fetching the list I want.

Now, I have a new problem related to that. I want to be able to show that list in a pop-up list in a field on my layout. I tried creating a fourth value list that will show the values of my field with the calculation in it. Unfortunately value lists can only be created from indexed fields, and you cannot index a calculation field that references other fields.

It's a connundrum. Is there another way to show the values in a popup besides what I was trying to do?

I'm thinking I might not be able to solve this problem at all.

Perhaps you could change the calculated value list into a text field with auto-enter calculation (replace).

This might work for you or not, depending on what you're trying to achieve. After all, you are trying to break the rules here. There is a reason why FMP won't let you create the fourth VL. You might be able to fool it, but it also might backfire.

Perhaps you could change the calculated value list into a text field with auto-enter calculation (replace).

This might work for you or not, depending on what you're trying to achieve. After all, you are trying to break the rules here. There is a reason why FMP won't let you create the fourth VL. You might be able to fool it, but it also might backfire.

Perhaps you could change the calculated value list into a text field with auto-enter calculation (replace).

This might work for you or not, depending on what you're trying to achieve. After all, you are trying to break the rules here. There is a reason why FMP won't let you create the fourth VL. You might be able to fool it, but it also might backfire.

I want to populate rows in a repeating field using a loop in a script (Rows: first entry = number, second entry = descriptive name, subsequent entries are indexed names). This repeating field would be passed as a parameter to a subscript in another table. Here the contents of the repeating field would be shown in a 2-D format.

Filemaker 7 is supposed to support the repeating field structure. Unfortunately, I can't find script commands or functions that allow for a sequential entering or extracting of information from a repeating field (e.g. using a loop statement). Does FM7 not support the repeating field data structure?

Yep, lots of ways to skin a cat.

Oops, sorry Fluffy. blush.gif

A lot of my workarounds were rendered obsolete with the Get(CalculationRepetitionNumber) function in FM7. I haven't gotten around to using it for anything yet, so I still tend to think in terms of FM6 limitations.

confused.gif

I want to populate rows in a repeating field using a loop in a script (Rows: first entry = number, second entry = descriptive name, subsequent entries are indexed names). This repeating field would be passed as a parameter to a subscript in another table. Here the contents of the repeating field would be shown in a 2-D format.

Filemaker 7 is supposed to support the repeating field structure. Unfortunately, I can't find script commands or functions that allow for a sequential entering or extracting of information from a repeating field (e.g. using a loop statement). Does FM7 not support the repeating field data structure?

Yep, lots of ways to skin a cat.

Oops, sorry Fluffy. blush.gif

A lot of my workarounds were rendered obsolete with the Get(CalculationRepetitionNumber) function in FM7. I haven't gotten around to using it for anything yet, so I still tend to think in terms of FM6 limitations.

confused.gif

I want to populate rows in a repeating field using a loop in a script (Rows: first entry = number, second entry = descriptive name, subsequent entries are indexed names). This repeating field would be passed as a parameter to a subscript in another table. Here the contents of the repeating field would be shown in a 2-D format.

Filemaker 7 is supposed to support the repeating field structure. Unfortunately, I can't find script commands or functions that allow for a sequential entering or extracting of information from a repeating field (e.g. using a loop statement). Does FM7 not support the repeating field data structure?

Yep, lots of ways to skin a cat.

Oops, sorry Fluffy. blush.gif

A lot of my workarounds were rendered obsolete with the Get(CalculationRepetitionNumber) function in FM7. I haven't gotten around to using it for anything yet, so I still tend to think in terms of FM6 limitations.

confused.gif

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.