1) "\\" will evaluate as \. You may find it useful to do this: Substitute ( FilePathField ; "\\" ; "/" ) to replace the dos/windows directory separator with the / used in FileMaker file path expressions. \ is the "escape" character in FileMaker text expressions so to get the actual \ character, you type it in twice in text expressions, escaping the escape character.
2) Go to record/request/page specifying a number, specifies the position of a record in your current found set, not it's record ID. If your found set is unchanged by what you are doing use Get ( RecordNumber ) to capture the original position of your record.
If the found set is modified before you attempt to return to that "next record" you have to either preserve or restore that found set before you can go to that specified record. I've used two different approaches depending on platform and window management preferences:
Use two windows--one with your original found set to loop through one record at a time and one to manage a different found set of the same records. Your script then flips back and forth between windows--one or both of which may be hidden from the user.
Use two layouts based on two different occurrences of the same table and switch back and forth between the two layouts while using Freeze Window to keep the layout switches invisible. (A table occurrence is what we call the "boxes" found in Manage | Database | relationships that you use to define relationships. One such occurrence is specified in "show records from" in Layout Setup... for every layout in your database.
THe second option is what I use if I have a Windows system with Maximized windows as it avoids a windows resize issue created when you open new windows.
Most thanks for that..
I have done the filepath change in my db so the filename field extracted from the original dos string is changed at birth!
For the record stroll, I dont know how to reference the new window in the script, so in the meantime I have set a loop where : when I have all records I saet a variable $recid to get the record number.
Then I " do stuff ".
Then I go back to the full set, and set a $counter.
While the $counter < than the $recid i increment the counter and goto next record.
Ouch! As I progress through the set the time taken increases, but it'll do until I understand how to work with the new window (I had a look and it seemed a bit involved, asking me to specify it etc)....? ;-)
Thanks thus far...
If you use Get ( RecordNumber ) to capture the record's position, (I wouldn't call it RecID), you can use Gp To Record's calculation option to go to the specific record in one step instead a loop. Just make sure to select the "no dialog" option when you do so.
hmmm - I tried Get (RecordNumber) = $$recker as the calculation before, followed by Goto next record and it always showed up the dialog, so I just tried again with nodialog, and I get stuck on record 2...
Aaaaah - I tried the window switch, and bingo!! Much Thanks, but still struggling with using get (recordnumber) to get the next sequential record based on previously stored recordnumber. For that matter, when I used calculation to goto a record using a unique value field, that didnt work either...
I only have an incomplete picture of your script so I may be working off incorrect assumptions here...
Say you are on the 3rd record in your found set, you need to process data off of other records and then return to the 3rd record when done:
Set Variable [$RecNumb ; value: Get ( RecordNumber ) ]
#Then your steps to do your task go here
Go to Record/Request/Page [No dialog ; $RecNumb ]
This assumes that the records that are present at the beginning of this are still present with no additions or omissions and in the same sorted order.
Note: If your script does alter the found set such that you can't just return to the record number specified, you can also capture the value of a primary key in a global field and use Go To related Records to jump back to that record if you define the correct self join relationship.
Thanks - that completes the picture!
I though that as it was a calculation, I would have to give some expression to be evaluated - it wasn't obvious to me to just use the record number.
Is this the only way to go to a record for a calculation, or can you work it using other values?
A single variable IS an expression when entered into the specify calculation dialog. It's just a very simple calculation.
If you read my last post again, I mentioned Go To Related Records which can be used to reset the focus on a record with a specific value.
OK - I will for sure also check the Go To Related Records function - it makes sense to do it now, here, while I am getting the idea of FileMaker navigation - maybe also adding it will give someone else a good summary of some options in one place - thanks PhilModJunk - this is really useful!