Jump to content

Cannot get SetField: Status(Current Page Number) to work


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

Recommended Posts

I am using a Mac Laptop, FileMaker 5 v 3, System 9.1, with my standard LaserWriter setup normal. Wanting to number certain reports with a "Page n of x" page numbering scheme, I set up a global number field, "PageTotal." In the footer of the report layout I entered the text "Page ## of <<PageTotal>>" and then set up a script, "Set Page Number" to set the field but it does not set the page number.

The script reads like this

Enter Preview Mode

Go to Record/Request/Page(Last)

Set Field (PageTotal), Status(Current Page Number)

This did not seem to be a big deal but for some reason it does not work, and having a Senior Moment, I am not figuring it out. I have checked the field itself and it remains blisfully blank. I know there are a lot of you out there that can spot my error but I am not getting it fixed myself.

Thanks for any help.

Link to comment
Share on other sites

Thanks for the response so quick, LiveOak, but it really IS a global field. (I checked again after reading your post.) I tried the script again, in case the gods of frustration had checked out for a snack, but it still doesn't work. Wierd. I think I will replace the FM prefs next and see what happens.

... Nope. No joy. My head is starting to hurt.

Any other ideas?

[ April 12, 2001: Message edited by: Moon Mullins ]

Link to comment
Share on other sites

I'm a little confused. Page total can't be represented by Status (CurrentPageNumber) since that displays only the page being previewed or printed, not the entire number of pages.

Also, it defaults to "0" if nothing is being printed or previewed so to have a blank display is weird unless you have formatted the field to be blank if zero. Is the global a number field?

Link to comment
Share on other sites

First, replying to Signal:

Yes, the global is a number field. I can manually set it to any number and the script does not change its value. As to the validity of the script, the way it works is by going to preview and then to the last record (the first two script steps) then setting the field to the page number. The script sets the pagetotal field to the last page number, which is the total number of pages. By the way, this is a technique from Scriptology by John Mark Osborne, and I have used it successfully in other dbs before. In fact, I copied the script from the database it fails in into another database and it works as advertised.

Which brings up a much bigger problem. Between posts I used Recover, with no help, cloned and reimported data, and again no fix. The script fails to set the global irrespective of the found set or layout. Then, as I said above, I copied the script into another database and it worked correctly. This raises a pretty big problem for me, for it means something is corrupt in the database that neither Recovery or cloning fixes. It is a very highly developed database that is central to an entire system, and recreating it is out of the question. The issue now is no longer a scripting problem, it seems, but how to fix a database that will not respond to a script command. By the way, a sampling of other scripts that have existed for a while work fine. I hope I can get some more ideas from the experts out there, or from new guys, too. I will try anything and appreciate everything you have to offer. Perhaps this thread should be moved to a Really Big Trouble forum.

Link to comment
Share on other sites

Okay, my panic is subsided, but this is interesting. After the previous post, I went back to the problem database and on a whim, defined another global number field, then IMPORTED the script back from the database I had earlier copied the failing script. I reset the script to set the newly defined field and IT WORKS. I wish I knew what happened, but my anxiety level ratcheted down from the three-Prozac level it had risen to.

Now my question is: does anybody have experience like this, and what ill does this bode for the database that failed? This is pretty important to me as this is a db that is central to a large system we are about to launch commercially, and I don't like the feeling that a critical component may turn out to be unreliable.

Link to comment
Share on other sites

Okay, okay, okay. This is the last post,and I really feel stupid, but I finally found the error in the script that failed. I failed.

I failed to specify the field that the Set Field step was supposed to set.

I screwed up, and as a result I have been having a long conversation with myself in this forum. (Which is one way add up a lot of posts to become a full-fledged member.) I think I should rate myself about one star for this, but at least some of the new guys out there should not feel so bad if they screw up. I have been doing this for fourteen years (developing, that is. AND screwing up.)

Sorry to turn this forum into a diary.

Link to comment
Share on other sites

Moon (Great name and cool company name!),

You've hit on one of the great benefits of this forum. Sometimes even experienced programmers/developers get stuck. You know where the problem is in your code but when you look at it (sometimes many, many times) you see what you think should be there, not what is there. Working the problem can include, walking away from it for a while or talking yourself through it. You did that here in this forum. You solved your problem through a series of logical steps, testing your db and scripts methodically and ultimately successfully. Your exercise in problem solving will be a great lesson to the many visitors to this forum new to FileMaker and programming. Don't apologize, well done!

laugh.gif" border="0

Link to comment
Share on other sites

I think you're cheating to get your full-member status and I would ask that the administrator dock you 5 posts for talking to yourself. I thought of that first and now that I am a full member, I don't think anyone else should be allowed to use my method.

Seriously, there was an earlier thread about Globals being converted from other field types and maintaining some of their traits. Maybe that is what happened?

[ April 13, 2001: Message edited by: signal ]

Link to comment
Share on other sites

This topic is 7792 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.