Mark_W Posted October 9, 2002 Posted October 9, 2002 I am designing a database where any layout can be reached by choosing two pop-up numerical value lists "Stage" and "Batch". If stage is set to 1 and batch is set to 3 then you are taken to layout 13. If stage is set to 2 and batch is set to 4 then you are taken to layout 24. And so on... There is a clever Pause/resume script I am using to move between these layouts as the value is chosen in these two fields. So far so good... When the database I am designing is opened I would like the user to go to the last layout that they were working on. How do you ensure in a startup script that if there is a value in "stage" and "batch" (say 2 and 4 respectively) that it will go to that layout (say layout 24) BUT... and this is a big BUT... if no entry has been made in these fields (for instance; the very first time the database is opened) that it will enter a default value into both of these fields and go to that layout (say layout 11). i.e. How can I tell in a startup script if a field has ANY value in it and act (or not) on it accordingly. Could anybody clear this up?
CobaltSky Posted October 9, 2002 Posted October 9, 2002 In your startup script, you can set up an If [ ] test which uses the IsEmpty( ) function to test for a value in the Stage and Batch fields. So, you need a sequence in your start-up script along the lines of: If ["IsEmpty(Stage) or IsEmpty(Batch)"] Set Field ["Stage", " "1"] Set Field ["Batch", " "1"] EndIf Go to Layout ["StageBatch"] where 'StageBatch' is the name of a calculating number field with the formula: Stage & Batch
Mark_W Posted October 14, 2002 Author Posted October 14, 2002 Hi Cobalt Sky, Your solution seems to have a snag. Go to Layout ["StageBatch"] takes you to a layout number defined by Stage & Batch (Layout No 21) not to a layout called "21" As I now know, Layout number is not the same as a Layout name. I thought to differentiate Layouts using a tens and units split. A simple calculation could take any value entered in "stage", multiply it by ten and add it to the value entered in "batch". Simple, no?. Therefore, if you entered "2" in "stage" and "1" in batch the resulting value "stagebatch" would be "21". In order for this elegant solution to work I would have to have 20 layouts in front of this one before Filemaker would see this as Layout "21". Is there ANY way of using the Go to Layout script step that won't involve potentially dozens of blank layouts in order for the Layout number to match the layout name? Is there a better way to use field inputs to choose a layout? Please Help. I am totally stuck!
CobaltSky Posted October 15, 2002 Posted October 15, 2002 Yes, there is a better way. Your earlier explanation led me to thinking that you already had a layout for each number combination, and that you were in fact referring to layouts by their number rather than their name. This is obviously not the case. Given that the Stage and Batch fields are producing numbers which are part of the layout name rather than of the layout number, you will need a more sophisticated formula for the calculating field I suggested, to determine the layout number from an imputed layout name based on stage and batch. The formula I suggest you use is: PatternCount(Middle(LayoutNames(Status(CurrentFileName)), 1, Position(LayoutNames(Status(CurrentFileName)), "layout " & Stage & Batch, 1, 1)), "
Recommended Posts
This topic is 8079 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 accountSign in
Already have an account? Sign in here.
Sign In Now