Jump to content

Can you re-initialize a variable in a script?

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

Recommended Posts

  • Newbies

I am trying to re-initialize a variable within a loop in a script. Basically I want to save several pdf files with different file names that relate to each record. Everything works fine except the variable "$pdf_file" retains the first value it is assigned first time through the loop - the pdf is saved but written over by each successive loop. I have spent a couple of hours scouring the net for a solution but no luck - can anyone offer an explanation or another possible solution?


Here is the test script I have been working with.

Go to Layout [ “test” (Listing Data) ]

Enter Preview Mode

Go to Record/Request/Page [ First ]


Set Variable [ $pdf_file; Value:Listing Data::Company_Listing_Key & ".pdf" ]

Save Records as PDF [ File Name: “filemac:/G4 HD/Users/bob/Desktop/test pdf/$pdf_file”; Current record ] [ Restore; No dialog ]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

Link to comment
Share on other sites

It doesn't seem like it should make a difference but for some reason, the Data Viewer always shows the record value from the record before you entered preview mode. Therefore, the script variable never updates. Seems like a bug but maybe there is some explanation. Anyhow, if you remove the Enter Preview Mode step and run it while in browse mode, everything will work fine and produce the same results.

Link to comment
Share on other sites

  • Newbies

Thanks - You are right about the preview mode. I thought I had tried it without - obviously not. It is still giving me problems (FM quits on layouts with a lot of photos) but I'll look into that now.

Link to comment
Share on other sites

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