6 Replies Latest reply on Jul 9, 2014 11:04 AM by philmodjunk

    One button for going to one of two layouts based on date

    MichaelShearer

      Title

      One button for going to one of two layouts based on date

      Post

           I'm trying to setup one button that will go to one of two layouts based on the date. What function could I use for this?

           If the current date is > 7/7/2014 go to layout 1. If the current date is > 7/9/2014 go to layout 2.

           I know how to get current date and time and have put that in other scripts but this one eludes me. I thought about using or but I don't think that will work. I can set it up with a button for each layout but I it is far less cluttered with one button.

           Thx

           Mike

        • 1. Re: One button for going to one of two layouts based on date
          philmodjunk

               Where will you put the dates "7/7/2014" and "7/9/2014"? Will they be dates in fields in your database? Will they ever need to change?

               If [ Get ( CurrentDate ) > GetAsDate ( "7/9/2014" ) ]
                 Go to Layout ["Layout 1" (           ) ]
               Else IF [ Get ( CurrentDate ) > GetAsDate ( "7/7/2014" ) ]
                  Go to Layout [ "Layout 2" (      _ ]
               End if

                is one possibility, but you might also need to use a date field to hold the dates:

               If [ Get ( CurrentDate ) > Globals::gDate2 ]

                

          • 2. Re: One button for going to one of two layouts based on date
            MichaelShearer

                 I never give you the whole story. Sorry, 'bout that Chief.

                 Yes I am using a date field. Each week I use two dates. One is for games on Thur. and the second is for the Sun. games. I have a layout that just shows early games and one that shows the rest. I know you had said something about displaying field contents at specified times. That would be the idea setup. Any suggestions on where I can find info on that? So if someone logs on and goes to the SPS on Thur. they will only see the one pick. Then when they go to the layout on Sunday they will see them all. I didn't go to giving 17 records to each member like you suggested.

                 One other question. I want the records to update picks for each member at a set time and date. What could I use as a trigger? Could a date be a trigger? That way it would do the update at one time and not again until the next date comes up. Right now if I use an event like a layout opening it does the update each time it is opened. Not a big deal but I thought it would be neat if I can do it with the date.

                  

                 Thx

                 Mike

            • 3. Re: One button for going to one of two layouts based on date
              philmodjunk

                   Why wouldn't the same layout show data for Thursday games or Sunday games, but with a script that controls which are visible by finding different groups of records? Why would you need two layouts?

              • 4. Re: One button for going to one of two layouts based on date
                MichaelShearer

                     So you are saying have multiple records per person. I usually have 70-90 people in the club. Right now I have it so any picks they make are held in a layout. On the day I update the records it copies them and pastes them in the Season Pick Sheet for that week and into a master SPS that does all the calculations. I think if I have a record for each week (17) and another record for early games and one for Sunday games it would get to be too much.

                     I have setup two spread sheets. One with early picks and one with all picks. I'll have the button use the script you sent me.

                     As for the updating date function I guess I'll just use opening the layout as a trigger.

                     Am I wrong about the multi record thing. I'm thinking 70 members times 2 different pick dates times 17 weeks.

                     There is more to this then I thought.

                     Mike

                     PS Thank goodness I have FM. Writing code would be really deep.

                • 5. Re: One button for going to one of two layouts based on date
                  MichaelShearer

                       Good point about using one layout to display them all. I could have it do the update and that would control what they see.

                       Thx

                       I'll give it a try

                       Mike

                  • 6. Re: One button for going to one of two layouts based on date
                    philmodjunk

                         So you are saying have multiple records per person.

                         Often, a relational database design requires both a single record for each person and also multiple records for data linked to that one person. Thus, you end up with one table where you have a record for each member of your club and a related table where each "pick" is a different record linked to one of those records in the member table.

                         Members----<Picks

                         Members::__pkMemberID = Picks::_fkMemberID

                         For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained