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 4542 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

In order to build a very dynamic layout I have the following scenario: Users can select multiple "Resources" from a checkbox set and then the associated text label and icon will appear elsewhere on the layout for each selected resource. Also, each resource has a status associated with it (e.g., new, updated, cancelled); the aforementioned icon for each resource will be determined by that resource's current status.

It works as follows:

1) User selects 0...n "resources" from a checkbox set (i.e., Resource1, Resource2, ...). This is stored in the field "Activity_Resources"

2) Each resource has a field for storing its current status, e.g., ResourceStatus_Resource1, ResourceStatus_Resource2 (note that they are all named with this convention" "ResourceStatus_" & Resource#)

3) A repeating calculated field (which is "recalculate as needed") is defined as: GetValue( Extend(Activity_Resources) ; Get( CalculationRepetitionNumber ) ). This repeating field is called "Activity_Resource Names" and basically is just a handy trick for converting a list of items in to a repeating field.

4) There is a custom function StatusIcon(Status) which returns the correct image file of the icon associated with the given Status.

So far, so good: My repeating field "Activity_Resource Names" dynamically displays the resources when the user selects (or de-selects) from the checkbox.

To display the proper icon, there's a second repeating calculation field (which is "recalculate as needed"):

CurrentStatuses = GetField("ResourceStatus_" & Activity_Resource Names[Get(CalculationRepetitionNumber)])

CurrentStatuses should be a repeating field containing the status for each of the resources. The purpose of this repeating field is merely to use as the parameter for the custom function: StatusIcon(CurrentStatuses[n])

My problem is that the repeating field CurrentStatuses doesn't get calculated properly via the "GetField" function--- only CurrentStatuses[1] works... Any other repeat after the first value is empty.

Any thoughts or comments are appreciated.

thanks

Posted (edited)

I am sorry - I stopped following at some point. I believe it was this part that threw me off:

2) Each resource has a field for storing its current status, e.g., ResourceStatus_Resource1, ResourceStatus_Resource2 (note that they are all named with this convention" "ResourceStatus_" & Resource#)

That doesn't sound like a good arrangement; why don't you have a table of Resources, where each "resource" is a record. Then you could display the selected resources, along with their status and any other attribute, in a portal.

---

BTW, I don't see Extend() in your formula, so that's probably why you're only getting the first repetition. Still, it looks like you're building a very complex device to achieve something that could be achieved much more simply.

Edited by comment
  • Newbies
Posted

Comment,

The main reason that a relational model utilizing portals wasn't implemented here was because I inherited this db from a previous developer. The backbone of the system is the resources' statuses so I've been avoiding the prospect of rebuilding the whole thing (many layouts, scripts, calculated fields, etc).

Regarding Extend(), where do you suggest? I have two repeating calculated fields:

a) Activity_Resource Names[] = GetValue( Extend(Activity_Resources) ; Get( CalculationRepetitionNumber ) )

B) CurrentStatuses[] = GetField("ResourceStatus_" & Activity_Resource Names[Get(CalculationRepetitionNumber)])

I'm assuming that you're referring to the CurrentStatuses lack of Extend(). I understood that Extend() is only for use when defining a repeating field based on the calculation of a non-repeating field. In this case here, CurrentStatuses[] is calculated based on a repeating field-- so Extend() shouldn't be needed, correct?

thanks

Posted

I've been avoiding the prospect of rebuilding the whole thing

I am not sure that what you're doing is less work...

Regarding Extend(), I believe it should be something like=

Extend ( GetField ( "ResourceStatus_Resource" & Get ( CalculationRepetitionNumber ) ) )

This could probably be smartened by calculating the string instead of hard-coding it. OTOH, I wouldn't spend too much effort going in this direction.

Regarding your version, I suggest you remove the GetField() part, and see if it returns valid field names.

  • 5 weeks later...
  • Newbies
Posted

If a repeating field uses another repeating field (with the same number of repetitions), the calculation for each separate 'box' will automatically refer to the same repetition in the other field only. E.g. CurrentStatuses[3] will only 'see' Activity_Resource Names[3]. There's no need to specify the repetition as such, it won't even work, I think. In fact, it's practically impossible to specify any other repetition from another repeating field than the one you're on. It's purely 'horizontal'. The only exception is the first and only repetition of a non-repeater, which you can force to behave like a repeating field by using Extend().

So you might try:

CurrentStatuses[] = Extend( GetField( "ResourceStatus_" & Activity_Resource Names ) )

Activity_Resource Names is also a repeating field after all, so it should give you the corresponding repetition.

(Quickly tested (FMA12): I think this works)

HTH Peter

This topic is 4542 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.