Jump to content
Server Maintenance This Week. ×

Picky FileMaker?


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

Recommended Posts

I have a script where about half-way through I have the step..

Set Field[ Different Years, Status (CurrentFileName), "Year List")]

So I'm trying to set the field 'Different Years' to have every entry in the list "Year List"

If there are multiple years in "Year List", my script works perfectly.

However, if there is only one year, the "Set Field" step doesn't work and my field is left blank (which completly breaks the script because I use that field for some finds.)

If I cancel the script, and then run that step by itself (setting the field) the single year is properly copied into my field.

There are no If statements in my main script that may result in that step being skipped.

Any suggestions?

Link to comment
Share on other sites

I'm assuming that you meant to include "ValulistItems" in your calculation:

Set Field[ Different Years, ValulistItems(Status (CurrentFileName), "Year List")]

My suggestion is to put a pause step immediately before and immediately after the set field step so that you can be absolutely sure that the step is executing. And, this may show you something else that is amiss.

Link to comment
Share on other sites

Thanks for the fix on my line of code, I messed up copying it onto my message.

On further testing I now need to re-phrase my problem. On my layout there is a portal from which I copy some information into the current database. If there are multiple records in the portal, the script runs fine, if there is only one record in the portal, it doesn't.

When there are multiple records in the portal I can see the list of years in a temporary field that I created based on "Year List." The list is copied correctly and the script works. The focus is not on anything on the screen.

When there is only a single record, the temporary field displays a message resembling <no value>. The focus remains on the first portal row (the only row) and my Different Years field is not set properly (because there are apparently no years in my list.) After I cancel the script, the correct year is displayed in the list but obviosly it's too late now.

Why would the focus remain in the portal when there is only a single record?

The script that I am using resembles this...

New Record

Set Field[ gNumRec, Count(Imports::Year) ]

Loop

Go To Portal Row( Select, "CurRec" )

Set Field[ "Year", "Imports::Year" ]

...2 other fields are copied in this way...

Exit Loop If[ CurRec = gNumRec ]

New Record

End Loop

Go To First Record

Where gNumRec is the number of records in the portal and CurRec is a field that automatically enters the current record number into it when created.

Again any suggestions are welcome and any help is greatly appreciated smile.gif" border="0

Link to comment
Share on other sites

I'm kind of guessing here. I suspect that it's one of those situations where something that you're editing affects a key field in a relationship, and that prevents things from being calculated until the record is exited. So, I suggest that you put in an "Exit Record/Request" step in your script somewhere before the Set Field that's causing trouble.

Link to comment
Share on other sites

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