Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 3535 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Does anyone know how you store data in a Calculation field's "Repetitions"? This isn't about referencing a separate repeating field or a relationship. I want all the action to happen in this one calculation field, but in different repetitions of this calculation field. 

Example: Calculation field name "CalcyCalc" with "Number of repetitions" in Calculation Options changed from 1 to 3. 

My calculation would be something like 

Case(month( Get ( CurrentDate ) )=1, *** repetition 1 of this calculation field CalcyCalc  = "Tom" *** )

;

Case(month( Get ( CurrentDate ) )=2, *** repetition 2 of this calculation field CalcyCalc  = "Dick" *** )

;

Case(month( Get ( CurrentDate ) )=3, *** repetition 3 of this calculation field CalcyCalc  = "Harry" *** )

-------

What I'm missing is the stuff set off by the triple asterisks. How does it work? It would be a simple way to do what I want without creating three separate fields. I'm going to put it on a layout with all the repetitions showing. 

With no way to specify where to put the results, all the repetitions in the Calc field display the same thing. 

Posted

IExample: Calculation field name "CalcyCalc" with "Number of repetitions" in Calculation Options changed from 1 to 3. 

My calculation would be something like 

Case(month( Get ( CurrentDate ) )=1, *** repetition 1 of this calculation field CalcyCalc  = "Tom" *** )

;

Case(month( Get ( CurrentDate ) )=2, *** repetition 2 of this calculation field CalcyCalc  = "Dick" *** )

;

Case(month( Get ( CurrentDate ) )=3, *** repetition 3 of this calculation field CalcyCalc  = "Harry" *** )

-------

​I don't understand this example. What is the actual result you're trying to achieve? A calculation field with three repetitions returns three separate results; in your case, there are 12 possible months - so you need to have a matrix of 12x3 possible results.

Posted

In addition to what Barb is saying; reconsider repeating fields when it comes to real data.  Repeating fields are useful but usually not when it comes to storing real data.  So instead of fixing the issue at hand, you may get more mileage from a more thorough re-examination of your tables / entities

Posted (edited)

My example was poor. I appreciate the responses. Thank you bcooney for that helpful link explanation of using repeating fields -- definitely a bookmark. 

This documentation from Filemaker mentions Calculations with repetitions. The documentation says

Select Number of repetitions, then type the number of repetitions. 

http://www.filemaker.com/help/11/fmp/html/create_db.8.15.html 

Below is a test calculation. The result in a calculation field with 1 repetition  is "Q". The result in a calculation field with 10 repetitions is a "Q" in each repetition. 

Is it possible to specify a "Q" in the first calculation field repetition, an "X" in the second calculation field repetition, and so on? What would the function be? 

This must be easy if only I could explain what I want to know better.

_=_=_=_=_=_=_=_=_=_=_=_=_=_=_

Let ( 

$firstnumber  =   6;  // placeholder for test purposes only
$secondnumber  =  6;  // placeholder for test purposes only
$bullet=  "Q"   ;
$bulletmatch = Case ( $firstnumber = $secondnumber ; $bullet)

 ]; // end variables

// start calc

$bulletmatch

// end calc

) // end let

 

 

Edited by RoundtableSam
changed "no repetitions" to "1 repetition
Posted

Is it possible to specify a "Q" in the first calculation field repetition, an "X" in the second calculation field repetition, and so on? What would the function be?

​So we still have no idea what you want to do, but you should look at Get ( CalculationRepetitionNumber );

Choose ( Get ( CalculationRepetitionNumber ) - 1 ;
  "Q" ;
  "X" ;
  …
)

or

GetValue ( "Q¶X¶…" ; Get ( CalculationRepetitionNumber ) )

  • Like 1
Posted (edited)

Is it possible to specify a "Q" in the first calculation field repetition, an "X" in the second calculation field repetition, and so on?

​Yes, it is possible - but you might get better answers if you explain the purpose of having such calculation. At this point, it seems like the best solution would be to type "Q", "X", etc. directly onto the layout.

Edited by comment
Posted

Hi, eos.

Not sure if this explanation will help because my main goal is to learn how calculation repetitions work rather than how to solve a particular problem. Im a long-time hobbyist, hence the gaps in my knowledge. I thank you all for taking the time to answer. 

Is there a Set( CalculationRepetitionNumber ) function similar to the set field script step?

Define fields > "new field name" > Type: Calculation > Options… > Number of repetitions. The default is "1".

This morning I was experimenting with highlighting a row of buttons based on a month or day of the week or some other easy to calculate trigger. Lots of other things would work, such as conditional formatting or multiple fields or multiple scripts, but they all have problems such as hard coding or other things.

Before today, I'd never noticed the repetition option on calculation fields. It seemed like that might be a cool way to make a highlight since it would just be one field with a calculation that would result in a bullet "•" in the desired location. One field with a number of repetitions is easy to layout and easy to change if needed. If it would work.

I can't find any documentation that would tell me how repetition of calculation fields work. There is endless documentation on how to use repeating fields IN calculations, but not how to fill repetitions OF calculation fields. My example calc puts the same data in all repetitions. 

Posted

Is there a Set( CalculationRepetitionNumber ) function similar to the set field script step?

​No, but there's the Get ( CalculationRepetitionNumber ) function that you can use in order to control the result of each individual repetition (as shown in the example given by eos).

 

my main goal is to learn how calculation repetitions work rather than how to solve a particular problem.

​Perhaps this might be helpful:

  • Like 1
Posted

Eos, comment, Get ( CalculationRepetitionNumber ) worked perfectly and elegantly. 

Thank you, and thank you for your patience. 

Below is the test calc. 

Let ( 

$repeater=Get ( CalculationRepetitionNumber ); 
$number= 1; // for actual, use calculated value instead of static value
$bullet="•";
$bulletmatch=Case($repeater=$number; $bullet);

$end=0 //last variable is not followed by semi-colon

 ]; // end variables

// start calc

$bulletmatch 

// end calc

) // end let

Posted

Note:

Using $variables in a Let()function is not a good idea - unless you actually want those variables to persist after the calculation is evaluated (until you close the file).

Posted

Note:

Using $variables in a Let()function is not a good idea - unless you actually want those variables to persist after the calculation is evaluated (until you close the file).

​Are $$variables okay?

Posted

​Are $$variables okay?

No you should use unprefixed variables, e.g.

Let ( [
i = Get ( CalculationRepetitionNumber ) ;
text = Extend ( Textfield )
] ; 
Middle ( text ; i ; 1 )
) 

The scope of these variables does not exceed their parent Let() function. The scope of local $variables (single $) is the current script. The scope of global $$variables is the current session. See also  http://fmforums.com/forums/topic/90920-retrieve-variables-set-in-another-script-you-performed/?do=findComment&comment=417743 and http://fmforums.com/forums/topic/94863-how-can-i-use-the-let-function-to-set-a-localvariable/?do=findComment&comment=434320.

 

Posted

No you should use unprefixed variables, e.g.

Let ( [
i = Get ( CalculationRepetitionNumber ) ;
text = Extend ( Textfield )
] ; 
Middle ( text ; i ; 1 )
) 

The scope of these variables does not exceed their parent Let() function. The scope of local $variables (single $) is the current script. The scope of global $$variables is the current session. See also  http://fmforums.com/forums/topic/90920-retrieve-variables-set-in-another-script-you-performed/?do=findComment&comment=417743 and http://fmforums.com/forums/topic/94863-how-can-i-use-the-let-function-to-set-a-localvariable/?do=findComment&comment=434320.

 

​Like I said, huge gaps in my knowledge. This is very helpful. Thanks, again, comment. 

This topic is 3535 days old. Please don't post here. Open a new topic instead.

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

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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