Jump to content

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

Recommended Posts

Posted

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

Posted

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

Posted

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))

Posted

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.

Posted

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...
Posted

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

Posted

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))

Posted

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

Posted

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)

Posted

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 !!

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