Jump to content
Server Maintenance This Week. ×

setting a repeating global container fields individual repetition


Recommended Posts

Hello,

I have searched high and low and can't come up with an answer to this. Hopefully I will explain it correctly. 

I am trying to create a universal navigation bar. I have a separate navigation table to do this so any changes I make in that table will carry across the entire database and I don't have to paste the bar on every layout. On my layouts I have 2 navigation bars. Both have a graphic and label to show where they are. 

One is used to navigate between modules (Jobs, Accounting, Warehouse etc.). This one works well as it is the same on every layout. Each "button" on the bar has 2 repeating fields, a container field and a text field and each is it's own repetition of those fields. I use a  "hide when" calc on a translucent background to show which module is active. It has a navigation script attached with a parameter based on the repetition. Works great.

The second one needs to be dynamic and will show navigation within the module that the user is on. Separate set of buttons for Jobs and separate set for accounting.

I have made one in the past based on a sample I saw, but it used a separate global field for each buttons graphic, each buttons label (active and inactive) each buttons script parameter and each buttons Background. Needless to say this got rather bulky in the number of fields used. 

I am attempting to streamline this by using repeating fields. one for graphics, one for labels, one for script parameters. The idea being each navigation button will be a repetition of those fields and will be populated by a calculation based on what module and layout the user is in. 

The issue I have is I don't know how to create a field calculation that sets each repetition based on that. For example, If the module the button is on is "Jobs" I want the container fields calc to set repetition 1 to a particular container field and repetition 2 with a different container field. And of course if the module is "Accounting" then those repetitions would contain different container fields.

I have searched and I keep running across Get ( CalculationRepetitionNumber ) but I don't see how that will work as it does not specify what field and when I use the data viewer, it always shows 1 no matter what field or what repetition of a field I am in. 

Is there a way to do what I am attempting? Any help would be greatly appreciated and I hope I explained it well enough.

 

Mike

Filemaker Pro 2023 running on Filemaker Cloud

Link to comment
Share on other sites

This is quite confusing! Your title speaks about "setting" a field, but IIUC you are talking about a calculation field? A calculation field cannot be set. It calculates its own result, using the formula you have provided when defining the field.

Now, in order to have the calculation return a value from some field in repetition 1 and a value from another field in repetition 2, you could make the formula along the lines of:

Extend ( 
Case ( 
Get ( CalculationRepetitionNumber ) = 1 ; Somefield  ;
Get ( CalculationRepetitionNumber ) = 2 ; Anotherfield 
)
)

Or, if you prefer:

Extend ( 
Choose ( Get ( CalculationRepetitionNumber ) - 1 ;
Somefield  ;
Anotherfield 
)
)

Note that this assumes that the source fields are not repeating fields.

Another thing is that you say that the calculation field is global. A global calculation field is stored, and will not recalculate unless one of the referenced fields is modified. I wasn't able to follow your description of the navigating mechanism to see how you intend to tell the field where you are. It sounds like the field should be unstored rather than global - if it should be a calculation field at all. If this is about navigation using buttons, then my preference would be to place the entire logic inside a script, rather than split it between button action and field calculation/s.

 

Edited by comment
Link to comment
Share on other sites

Thank you for your response,

I see how using the word "setting" can be confusing, my bad. I did manage to make the CalculationRepetitionNumber work, so thank you for that. 

The navigation would be determined by the layout name. all my layouts start with the module they are part of (all my accounting layouts start with ACCT, warehouse WT etc). The plan was to have the calculation say, Case ( LeftWords ( Get ( LayoutName) ; 1 ) = "ACCT", then set the repetitions to the Accounting graphics and labels, if it's WT the warehouse ones. the layout name being the reference, that should change the calc, correct?

But after giving it some thought, I did decide to set the fields within the navigation script connected with the buttons. I thought it would be easier to do it on field level being as I have a number of scripts other than my navigation bar that will change layouts and I have to make sure the fields are set when those scripts are run. I will make setting the navigation bar a subscript so I can add it to the other scripts, I just have to make sure I don't miss one. 

thanks for your help

Link to comment
Share on other sites

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.