Jump to content
Server Maintenance This Week. ×

Set variable script for a calendar


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

Recommended Posts

Hi all,

I decided to try and build a simple calendar using portal filtering. I found a great article on the subject at here, and although it has been a great help, I am having trouble getting the calendar to display the date and events in all of the 42 portals (right now it just shows that information for the current month).

Below is the script they used to set the variables and I just can't seem to modify it to show the information I want.

Commit Records/Requests

Set Variable [ $start; Value:GetAsDate ( Div ( interface::firstOfMonth ; 7 ) * 7 ) ]

Set Variable [ $thisMonth; Value:Month ( interface::firstOfMonth ) ]

Set Variable [ $n; Value:0 ]

Loop

Set Variable [ $n; Value:$n + 1 ]

Exit Loop If [ $n > 42 ]

Set Variable [ $d; Value:$start + $n - 1 ]

Set Variable [ $varName; Value:"$$day" & Right ( "0" & $n ; 2 ) ]

Set Variable [ $varValue; Value:If ( Month ( $d ) = $thisMonth ; $d ; " " ) ]

Set Variable [ $varType; Value:If ( Month ( $d ) = $thisMonth ; "Date" ; "Text" ) ]

Set Variable [ $garbage; Value:Let ( [ varName = If ( Left ( $varName ; 1) ≠ "$" ; "$" ) & $varName ; varType = GetValue ( FilterValues ( "Text¶Number¶Date¶Time¶Timestamp" ; $varType ) ; 1 ) ; varValue = $varValue ; f = "Let ( ~varName~ = ~varValue~ ; \"\" )" ; fGetAs = "Let ( ~varName~ = GetAsXX ( ~varValue~ ) ; \"\" )" ; formula = If ( IsEmpty ( $varType ) ; f ; Substitute ( fGetAs ; "XX" ; $varType ) ) ] ; EvaluationError ( Evaluate ( Substitute ( formula ; [ "~varName~" ; varName ] ; [ "~varValue~" ; Quote(varValue) ] ) // close Substitute ) ) // close Evaluate ) //close Let ]

End Loop

Refresh Window [ Flush cached join results ]

I am really having a hard time parsing the script well enough to understand exactly what I need to change, so any help will be greatly appreciated.

Thanks in advance!

-V

Link to comment
Share on other sites

Developers have been creating calendar interfaces with FileMaker for a while using a technique involving forty-two separate relationships and portals.

Not really:

http://fmforums.com/forum/topic/42617-basic-monthly-calendar-april-06/

Link to comment
Share on other sites

Not really:

http://fmforums.com/forum/topic/42617-basic-monthly-calendar-april-06/

True, but I thought that this was an interesting approach for making a calendar. It does use 42 portals for the layout, but it only needs one relationship between two tables: Interface and Events. Filtering is used on each portal to only show the events for that particular day. I know it only works in FM 11, but I seems like it might be a nice way to do a calendar.

Link to comment
Share on other sites

If I wanted to go that route, I would use only 7 portals x 6 records. Here are some of the reasons:

• filtered portals are faster when the amount of records to process is reduced by the relationship;

* the filtering formula would be MUCH simpler;

• it's no fun setting up 42 portals, each one with its own settings.

Link to comment
Share on other sites

If I wanted to go that route, I would use only 7 portals x 6 records. Here are some of the reasons:

• filtered portals are faster when the amount of records to process is reduced by the relationship;

* the filtering formula would be MUCH simpler;

• it's no fun setting up 42 portals, each one with its own settings.

LOL, I wholeheartedly agree with the last bit, setting up the 42 portals was a real pain.

Back to my original question: I figured out that changing these two steps in the loop:

Set Variable [ $varValue; Value:If ( Month ( $d ) = $thisMonth ; $d ; " " ) ]

Set Variable [ $varType; Value:If ( Month ( $d ) = $thisMonth ; "Date" ; "Text" ) ]

to this

Set Variable [ $varValue; Value:$d ]

Set Variable [ $varType; Value:"Date" ]

would give me what I wanted, but I'm still having trouble wrapping my head around the whole "Set Variable [ $garbage; Value:Let..." part at the end.

I really don't like using things I don't understand, would anyone mind breaking it down for me?

Thanks!

Link to comment
Share on other sites

Frankly, I have no idea what that script does, or why. I believe that even with 42 portals, things could be somewhat simpler - see the attached.

Note that I've only done the first and the last row before getting tired of it.

I could not make much sense of that script either (it sets variables for the 42 merge fields that go along with the 42 portals). Thanks for your example, it is much easier to comprehend.

I am not sure if filtering portals is really a great way to do a calendar, but it has been an interesting experience.

Link to comment
Share on other sites

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