Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I am stumped why this isn't working. I hope someone here can help. I have 2 tables. Table 1 has a field named "Value". Table 2 has fields named "Total set value", "Value used", and "Value left". I have a simple script that checks to see if Value in table 1 + the Value used in table 2 is > than Value left in table 2. It looks like this

If[(Table 1::Value + Table 2::Value used) > Table 2::Value left]

Beep

End If

My problem is that the computer continues to think that Value + Value used is always > than Value left. Even if Value is set to 1, Value used is set to 2, and Value left is set to 100. Maybe I'm missing something. Any help given is much appreciated.

Posted

I have a join file between the two. The join file is used to show records from Table 1 in a portal in Table 2. The Field "Value Used"(in table 2) is a calculation that sums all the numeric values of the records in the portal. The Field "Value" is just a text field that automatically enters 450 when a new record is created. The field "Value Left" is a calculation field that calculates Value - Value Used. I have a script that transfers records from Table 1 into the Portal in Table 2. What I'm trying to do is put an if statement in the script that checks to see if by adding this record to the portal, will the "Value Used" be higher than the amount limit in the field "Value". If it exceeds the limit I want a display to come up and say, adding this will increase the cost beyond the limit set "450"

I hope this makes sence. Thanks for any help you can give me.

Posted

I'm not sure I understand what you're doing, but maybe it has something to do with the context (i.e. the layout) from where the calculation is being evaluated -- always worth checking in FileMaker 7.

One way to troubleshoot this is to make some global fields and put them on your layout, and run a script that sets Table 1::Value into globalFieldA, Table 2::Value used into globalFieldB, and Table 2::Value left into globalFieldC. Now: do A, B, and C have the values you expect? My guess is, they don't. So that will give you a place to start.

Also: why is "Value" a text field? 450 is a number, and from your description, should be treated as such. I.e., use a number field.

Posted

AAAAHHHH! Throws computer out window! I decided to skip relationships all together and just do a copy from table 1 and paste into a test field in table 2. The script then checks to see if the number in the Field "Value Used" + test field is greater than the number in the field Value. If it is then beep. If not continue with the script. It works for a little bit and then starts acting up again. In other words, the computer always thinks it greater than whats in the field "Value". Even if the number in the field Value used is 0, the number in the test field is 7, and the number in the field "Value" is 20, the computer will still beep. Here is the script:

Go to Layout ["Collection Detail"]

Copy [select; Point Value]

Go to Layout["Team Builder"]

Paster [select; No style; Team Builder::) Point Value Temp Field]

If [(Team Builder::Value Temp Field + Team Builder::Value Used> Team Builder::Value]

Beep

Show Custom Dialog ["adding this will increase the cost beyond the limit set "450"]

Exit Script

End if

Perform Script ["Add to Team Builder"]

Esentially what is supposed to happen is the script will copy the number in the Point Value field in the Collection Detail table. It then paste that number into a test field called Point Value Temp Field in the Team Builder table. The if statement test to see if the number in Value Temp File + the number in Value Used is > than the number in Value. If it is the computer then beeps and exits the script, if not it performs the script "Add to Team Builder"

Posted

I would stuff the file, but its 96mb big. I think there is a limit on how big a posted file can be. Any ideas? Is my scripting syntax right? Is there supposed to be an else in there?

Thanks for your help

Posted

Are all those fields defined as number fields?

Posted

"Point Value Temp" is a number field

"Value Used" is a calculation that sums up the points of the records in the portal on the same layout. Its caculation looks like: Unstored, from Team Builder, = Sum( Team Builder join::calcPV)

"Value" is a Number field with Auto-enter Data "450" on it.

Essentially whats supposed to happen is, when your in "Collection Detail" table you are looking at different players. You then go to "Team Builder" table to create a new team record. You then go back to "Collection Detail", with a click of a button the script above runs. Which is intended to check to see how many points have been used in the new Team Builder record. If there is enough points, the script Add to Team Builder runs, which sends the record from Collection Detail into the portal row in the new Team Builder record. Each player in Collection Detail is worth a specific amount of points. Each team is limited to 450 points. So I need a message that will pop up and say "adding this will increase the cost beyond the limit set "450". I hope I'm not confusing you.

Heathbo

Posted

How about saving a clone of your file, stuff or zip it and upload it -- surely that won't be 96 mb?

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