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.

Featured Replies

maybe someone can help me with this problem i have a global field called global color which is a container 3 repetitions ,a field called global color value which is also a container ,a field called price paid which is a number field and a field called value which is also a number field what i want to do is have the global color field place one of 3 colors into the global color value field based on if price paid is equal to value, less than value,or greater than value i can do it as a script. see example but as a calculation i am a bit lost for some reason

global color = container 3 reps

global color value = container

price paid = number field

value = number field

This is the script that i am using

if ["value=price paid"]

Set Field ["Global Color Value","GetReptition(Global Color,1)"]

Else

If ["Value>Price Paid"]

Set Field ["Global Color Value","GetReptition(Global Color,2)"]

Else

If ["Value<Price Paid"]

Set Field ["Global Color Value","GetReptition(Global Color,3)"]

End if

End if

End if

any help wold be appreciated confused.gif

Make your Global Color Value a Case Statement.

Since you didn't provide more than on value = "price paid", I can only give you a generic "Next value" and "Next value 2" so just replace those with values needed.

Case(value="price paid", GetReptition(Global Color,1),

value="Next value", GetRepetition (Global Color, 2)

value="Next value", GetRepetition (Global Color, 3))

HTH

Lee

smile.gif

I just noticed I missed a comma at the end of the second statement.

Since I haven't tested this, this is only guessamont

Case(value="price paid", GetReptition(Global Color,1),

value="Next value", GetRepetition (Global Color, 2),

value="Next value", GetRepetition (Global Color, 3))

There are some examples of how to do this (and also change the colour of the text) in the file under my Handy Bits post in the Samples section of this forum. Go towards the end to make sure you get the latest version.

  • Author

Thanks for the help everyone with your help i figured it out below is the calculation in case someone else needs it in the future

Price Paid is a number field formatted for money

Value is a number field formatted for money

what it does is when the value field is equal to the price paid field

it returns repetition 1 from the global container called global color

when the value field is greater then the price paid field it returns repetition 2

and when the value field is less than price paid it returns repetition 3

rep 1 was blue

rep 2 was green

rep 3 was red

Case(

Value=Price Paid,GetRepetition(Global Color,1),

Value>Price Paid, GetRepetition(Global Color, 2),

Value<Price Paid, GetRepetition(Global Color, 3))

  • 2 weeks later...
  • Author

I have just noticed that when i create a new record the calculations does not work any more anyone have any ideas

Case(

Value=Price Paid,GetRepetition(Global Color,1),

Value>Price Paid, GetRepetition(Global Color, 2),

Value<Price Paid, GetRepetition(Global Color, 3))

but if i duplicate the very first record i made with the calculation i can change the contents of the global color field based on the price paid field

but not if i make a new record what can be going on anyone have any ideas

Hi,

Here is another solution :

Intermediate calc = Case(Value<Price Paid, 0, Value=Price 1, Value>Price Paid, 2)

You'll see that you will need this later when it comes to identify records based on status, either with classic finds or relationship. It's rather complicated to find them by a color or " > ", " < " " = "...

For some logic, 0 if not paid, 1 if paid, 2 if overpaid.

Then your Case statement or a Choose, that I'm starting to implement everywhere grin.gif

Choose(IntermediateCalc, GetRepetition(Global Color, 3), GetRepetition(Global Color,1), GetRepetition(Global Color,2))

  • Author

Answered my own question field was a repeating field of the container type but it was not a global field changed it to a global field and now it works when i make a new record. can any one explain why it does not work when it is just a repeating field when i original did this as a (If Else) script attached to a button it worked with just a repeating field anyone have any theorys on this

Hi,

Sorry my first answer was for your previous post.

Now to adress your current problem, you said "a field called global color value which is also a container".

Would this field not be a global field ? wink.gif

Make sure you didn't forgot that FM doesn't turn a container to global by the field name wether that by its field definition (container ----> GLOBAL)

Oups...

So you just solved it.

Now, think a second (one minute would be more than necessary).

You're creating a new record....so what is the value of your container ? New record = NO value in it !!

Hi again,

The script would never have worked on new record with a container field. Try it out again...

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.