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.

Calculation on a Repeating Field and Putting Result into Specific Repetition

Featured Replies

I've got a repeating field as a calculation and need to put a value into a specific repetition value/location, but I don't want to have to run a script every time to accomplish this.

 

For example, I have two fields, NumberField and RepeatingField[10]

 

When NumberField = 5 I need a 5 to show up in RepeatingField[5]  Can I do this in a calculation? If not, what's the best way to do this? This seems to trivial to me, but I'm looking for a elegant solution.

The best way is not to use repeating fields.

Why are you using them?

  • Author

Ha! I figured that. I thought I'd try because I thought there would be a simple and quick way with a repeating field and one calculation. Otherwise, I've got to create 10 fields and 10calculations which all would need to be maintained and cluttering up the table.

When NumberField = 5 I need a 5 to show up in RepeatingField[5]  Can I do this in a calculation?

 

Yes. But one example does not establish a rule.

 I've got to create 10 fields and 10calculations which all would need to be maintained and cluttering up the table.

 

If this is for developer use, there is nothing wrong with repeating fields - as long as it does not hold client data.  Can you explain the purpose here?  10 fields and 10 calculations indicates either 1) they should be records in a related table or 2) they are developer tools, doesn't it?

Why don't you describe more broadly what problem you are trying to solve and what the purpose of the  repeating fields is?

  • Author

Sure thing...

 

I have a table of tasks each with a due date. In list view I have each task and adjacent to each task are twelve columns one for each month. I just want to highlight the corresponding repeating value which corresponds to the the month. 

 

if Month = 1 then put a value in the first repeating field..If month  = 2 then put a value in the 2nd repeating field..so on. I can then do conditional formatting to get the highlighting.. I've already worked this solution out with 12 fields and 12 calculations...looking for a simpler solution.

What value do you want it to have?  Well, try this:

 

Create a calculation with 12 repetitions and a calculation of:

Let ( [
i = Get ( CalculationRepetitionNumber ) ;
d = Extend ( date ) 
] ;
Case ( i = Month ( d ) ; i )
)

You should be able to replace the final result where I have i - to be whatever you wish.  As is, that repetition fills with the month number. Adjust as needed.

  • Author

What value do you want it to have?  Well, try this:

 

Create a calculation with 12 repetitions and a calculation of:

Let ( [
i = Get ( CalculationRepetitionNumber ) ;
d = Extend ( date ) 
] ;
Case ( i = Month ( d ) ; i )
)

You should be able to replace the final result where I have i - to be whatever you wish.  As is, that repetition fills with the month number. Adjust as needed.

This works. Thank you! Can you explain how this works? How does it put 'i' into repetition['i']?

I'm pleased it worked for you, GisMo.  I lost my post so I'm try again to explain ...

 

i - is just the repetition number

d - is your date extended the same to all repetitions

 

If each repetition number identified as i ( evaluated from itself ) looking across to the matching 'rep number' of the extended  date equals the month number of the date (in its matching rep) then produce the result of i which is assigned as the local variable within the Let() otherwise produce no result.

 

So for another month example, instead of this:

 

Case ( i = Month ( d ) ; i )

 

it could be this:

 

Case ( i = Month ( d ) ; MonthName ( d ) ) 

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.