Option-Shift Click to create record in Source No 2

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 13
Joined: Sat Jul 24, 2010 7:43 am
PostPosted: Thu Dec 29, 2011 4:13 pm
I saw this post...

viewtopic.php?f=25&t=3304&hilit=option+shift

that explained that there would be a way to alter the scripts to recognize several different modifier keys, but I have not been able to find where to alter the script to make it work.

I have two sources, Appointments and Transparencies, and would love the ability to Shift-Click to create an Appointment, and Option-Shift-Click to create a Transparency.

Any help is as always greatly appreciated!

Thanks

Kevin
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Fri Dec 30, 2011 11:38 am
Hi Kevin,

We capture the modifier key and branch the different activities in the script : Click in / Drag Event. That's also the script that determines which source to interact with, so it should all be in there.

hth,
Jason
Posts: 13
Joined: Sat Jul 24, 2010 7:43 am
PostPosted: Sun Jan 01, 2012 1:41 pm
Hmmm, I have poked around for quite a while with these scripts, thinking I have found the proper place to add in the check for modifier keys, with no success. But, after reading my previously linked post again, I feel like a good alternative would be to only allow creation of records in source Transparency (source 2) if Appointment (source 1) is NOT shown. So, I turn off source 1 Appointments on the calendar (we always use Schedule view, no others), and try to create a Transparency, but it continues to take me to the Appointment layout, with errors of course that the layout is based on the wrong table. I believe I changed everything back to normal, any ideas why this would be happening?
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Mon Jan 02, 2012 7:45 am
Hi Kevin,

On the layout for your additional FileMaker Source, you need to specify which layout is used for the "Event Detail." For Source No 1, we've specified the "Event Details" and the script uses that text to determine where to land.

Source Set Up.png
Source Set Up.png (108.73 KiB) Viewed 19841 times


This happens in the script "Load Source Settings by Number ( SourceNo ) { Action }" which is called by the script "Click in / Drag Event." I mentioned in the previous post.

hth,
Jason
Posts: 13
Joined: Sat Jul 24, 2010 7:43 am
PostPosted: Tue Jan 03, 2012 11:02 am
I have confirmed that both the Source No 2 layout is based on Transparency (Source 2) and that the layout details for Transparency is also based on that table. Still no luck. If I make the only active source Transparency, it still creates a new record in Appointments. If I change the script Determine Source for New Event to simply exit script with result 2, it STILL doesn't create the new event in table Transparency (Source No 2). At the moment, it is not defaulting creation to Source No 2 if Source 1 is inactive, even though the Script Determine Source... is clearly choosing the second source is Source 1 is inactive.
Posts: 13
Joined: Sat Jul 24, 2010 7:43 am
PostPosted: Tue Jan 03, 2012 11:43 am
Oh, and I forgot to mention that going to the event, in both sources, works as expected. I can click on a Transparency to view / edit that transparency. I just can't shift click to create a transparency.
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Wed Jan 04, 2012 5:02 am
Hi Kevin,

I think this might be related to an issue we have in the current code. In the script Determine source for a new event, the calculation for the script result is incorrect. Please change it to:

Case (

// If Default source is active, use it

not IsEmpty ( FilterValues ( $$sc_SourcesActive ; $$sc_SourcetoDefaultForNewItems ) ) ; $$sc_SourcetoDefaultForNewItems ;

// Look for first FileMaker source


$$sc_SourceType[1] = "FileMaker" ; 1 ;
$$sc_SourceType[2] = "FileMaker" ; 2 ;
$$sc_SourceType[3] = "FileMaker" ; 3 ;
$$sc_SourceType[4] = "FileMaker" ; 4 ;
$$sc_SourceType[5] = "FileMaker" ; 5 ;

// Default source

$$sc_SourcetoDefaultForNewItems

)

I THINK that might be the trouble.

Let me know!
Posts: 13
Joined: Sat Jul 24, 2010 7:43 am
PostPosted: Fri Jan 06, 2012 8:40 am
Thanks so much for your time, I still am unable to work this out. I pasted in the updated script to Determine Source for new event, with no luck. I can even set this script to exit with result 2, and it will STILL create the new event for source 1. Something else must be amiss...

When I turn OFF Appointments (Source1), and only show Transparency (Source2), the data viewer shows:

$$sc_SourcesActive 2
$$sc_SourceToDefaultForNewEvent 1

When I shift click, the data viewer shows a bunch of new variables, $$sc_FieldFor... showing fields from Appointments. The script seems to be ignoring the Determine Source script and simply using Source 1 all the time. Will look through all the relevant scripts again, see if I jacked something up in my testing. Any other ideas?
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Fri Jan 06, 2012 1:03 pm
Hi Kevin,

Ok, two things. I think there's still an issue with the Case Statement. As once it realizes the active source is not the default it just goes down the list without checking for active first, so that's why "Determine source for a new event" is still returning a 1. After further review it should look like this:


Case (

// If Default source is active, use it

not IsEmpty ( FilterValues ( $$sc_SourcesActive ; $$sc_SourcetoDefaultForNewItems ) ) ; $$sc_SourcetoDefaultForNewItems ;

// Look for first ACTIVE FileMaker source

$$sc_SourceType[1] = "FileMaker" AND not IsEmpty ( FilterValues ( $$sc_SourcesActive ; "1" ) ) ; 1 ;
$$sc_SourceType[2] = "FileMaker" AND not IsEmpty ( FilterValues ( $$sc_SourcesActive ; "2" ) ) ; 2 ;
$$sc_SourceType[3] = "FileMaker" AND not IsEmpty ( FilterValues ( $$sc_SourcesActive ; "3" ) ) ; 3 ;
$$sc_SourceType[4] = "FileMaker" AND not IsEmpty ( FilterValues ( $$sc_SourcesActive ; "4" ) ) ; 4 ;
$$sc_SourceType[5] = "FileMaker" AND not IsEmpty ( FilterValues ( $$sc_SourcesActive ; "5" ) ) ; 5 ;

// Default source

$$sc_SourcetoDefaultForNewItems

)

That should correct that script, but it sounds like you did a manual bypass on that and are still seeing issues, but hopefully the above will resolve it. The process is to call the script "Create Edit Delete Event" after determining the correct source and passing the source number as a parameter: see below:

Screen Shot 2012-01-06 at 2.00.12 PM.png
Screen Shot 2012-01-06 at 2.00.12 PM.png (59.96 KiB) Viewed 19828 times


Let me know if that helps. If the edit process is working, I think you're close!
-J
Posts: 13
Joined: Sat Jul 24, 2010 7:43 am
PostPosted: Mon Jan 09, 2012 5:26 pm
Well, I have updated the script, checked all the components involved in click / drag, create / edit event, all those scripts, and still can't seem to get it to create a record in source no 2. Strange, since it opens an existing record in source no 2 in the proper layout. I am at a loss! Will look for a different way to do it, and keep peeking around for the answer. I am sure it is something simple I am missing, or something I changed during testing that didn't get changed back.

Thanks for all your time and consideration with this issue.

Kevin
SeedCode Staff
SeedCode Staff
Posts: 691
Joined: Mon Feb 28, 2011 2:47 pm
PostPosted: Tue Jan 10, 2012 10:42 am
Hi Kevin,

Sometimes it is a matter of slogging through the debugger step by step to see why you're not on the right source layout.

Let me know if you make any progress (or not)

Cheers!

Return to SeedCode Calendar

Who is online

Users browsing this forum: No registered users and 3 guests

(855) SEEDCODE
[email protected]
Follow us: