dbTalk Databases Forums  

clicking and if statements

comp.databases.filemaker comp.databases.filemaker


Discuss clicking and if statements in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
pri
 
Posts: n/a

Default clicking and if statements - 06-28-2005 , 04:00 PM






hi all,
i have asked a similar queston before, but let me try again.

i have a few protals in a layout and they all have same field names. I
would like to be ble to click on field A and have a script do
something. And if i click in a different portal's field A i would like
a similar script run, (as you might guess the only difference in the
scripts is the fields referenced). So right now i have for each field
in evey portal with a separate specific script. I was wondering if it
would be possible for FMP7.0 to somehow know/calculate which field was
clicked on?

i would like something as the following to happen:

IF (clicked_field = "portalA::fieldA" then....)
ELSEIF (clicked_field = "portalB::fieldA" then...)
ELSEIF (clicked_field = "portalC::fieldA" then...)

is this possible? i am not familiar with the functions in FMP7 but how
can i achieve the function of "knowing" what the clicked field is?

second question:

as a debugging feature i added a text field called INFO in my layout.
everytime i run a script i am trying to fill INFO with particular
information. i.e. Insert Text [Select;TableA::INFO;"Get
(ActiveFieldName)"]
when the script runs, all i get in the INFO field is Get
(ActiveFieldName), instead of the actual name. can someone tell me how
to fill that INFO field with the fieldname.

TIA


Reply With Quote
  #2  
Old   
Matt Wills
 
Posts: n/a

Default Re: clicking and if statements - 06-28-2005 , 04:30 PM








pri wrote:

Quote:
hi all,
i have asked a similar queston before, but let me try again.

i have a few protals in a layout and they all have same field names. I
would like to be ble to click on field A and have a script do
something. And if i click in a different portal's field A i would like
a similar script run, (as you might guess the only difference in the
scripts is the fields referenced). So right now i have for each field
in evey portal with a separate specific script. I was wondering if it
would be possible for FMP7.0 to somehow know/calculate which field was
clicked on?

i would like something as the following to happen:

IF (clicked_field = "portalA::fieldA" then....)
ELSEIF (clicked_field = "portalB::fieldA" then...)
ELSEIF (clicked_field = "portalC::fieldA" then...)

is this possible? i am not familiar with the functions in FMP7 but how
can i achieve the function of "knowing" what the clicked field is?

You can run the same script from multiple buttons with different results.

When you format a button to perform a script, at the bottom of the window
where you specify the script is a pane titled Optional Script Parameter.

Used in conjunction with the Get ( SCriptParameter ) function as part of
an If step in a script, your script can behave differently depending on
which button is clicked.

For instance, specify the Optional Script Parameter as 1 for one button, 2
for another.

In the script, include a routine such as

If Get (ScriptParameter) = 1
Do this
Else If Get (ScriptParameter) = 2
Do Something else
End If.

Quote:
second question:

as a debugging feature i added a text field called INFO in my layout.
everytime i run a script i am trying to fill INFO with particular
information. i.e. Insert Text [Select;TableA::INFO;"Get
(ActiveFieldName)"]
when the script runs, all i get in the INFO field is Get
(ActiveFieldName), instead of the actual name. can someone tell me how
to fill that INFO field with the fieldname.
Insert text does just that: you're inserting text, literally
"Get(ActiveFieldName)". Make the script step Insert Calculated Result [Get
(ActiveFieldName)]

Matt


Reply With Quote
  #3  
Old   
Dan
 
Posts: n/a

Default Re: clicking and if statements - 06-28-2005 , 04:38 PM



Hello pri,

With regard to your last question - you need to use the step Insert Calculated
Result[..etc

I assume that you are setting up the fields in your portals as buttons. One
thing you could do is to use the same script each time and pass different
parameters to the scripts according to which field you are clicking. A parameter
can be calculated; so in particular you could include the Get(ActiveFieldName)
in your calculation to pass on to the script.


Quote:
hi all,
i have asked a similar queston before, but let me try again.
i have a few protals in a layout and they all have same field names. I
would like to be ble to click on field A and have a script do
something. And if i click in a different portal's field A i would like
a similar script run, (as you might guess the only difference in the
scripts is the fields referenced). So right now i have for each field
in evey portal with a separate specific script. I was wondering if it
would be possible for FMP7.0 to somehow know/calculate which field was
clicked on?

i would like something as the following to happen:

IF (clicked_field = "portalA::fieldA" then....) ELSEIF (clicked_field
= "portalB::fieldA" then...) ELSEIF (clicked_field = "portalC::fieldA"
then...)

is this possible? i am not familiar with the functions in FMP7 but how
can i achieve the function of "knowing" what the clicked field is?

second question:

as a debugging feature i added a text field called INFO in my layout.
everytime i run a script i am trying to fill INFO with particular
information. i.e. Insert Text [Select;TableA::INFO;"Get
(ActiveFieldName)"]
when the script runs, all i get in the INFO field is Get
(ActiveFieldName), instead of the actual name. can someone tell me how
to fill that INFO field with the fieldname.
TIA





Reply With Quote
  #4  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: clicking and if statements - 06-28-2005 , 11:57 PM



pri wrote:
Quote:
i have a few protals in a layout and they all have same field names. I
would like to be ble to click on field A and have a script do
something. And if i click in a different portal's field A i would like
a similar script run, (as you might guess the only difference in the
scripts is the fields referenced). So right now i have for each field
in evey portal with a separate specific script. I was wondering if it
would be possible for FMP7.0 to somehow know/calculate which field was
clicked on?

is this possible? i am not familiar with the functions in FMP7 but how
can i achieve the function of "knowing" what the clicked field is?
You can't click 'in' a field to trigger a script (well, you can with a
plug-in, but that's a different story). But you can set the field to be
a button so that a script is run when you click on the field. When you
define the field/button, just include a script parameter in the dialog
where you specify the one script to run. Make the script parameter
whatever you want -- field name, for example.

In your script, you can test using something like:
IF (get(ScriptParameter) = "portalA::fieldA" then....)
ELSEIF (get(ScriptParameter) = "portalB::fieldA" then...)
etc

Quote:
second question:
as a debugging feature i added a text field called INFO in my layout.
everytime i run a script i am trying to fill INFO with particular
information. i.e. Insert Text [Select;TableA::INFO;"Get
(ActiveFieldName)"]
when the script runs, all i get in the INFO field is Get
(ActiveFieldName), instead of the actual name. can someone tell me how
to fill that INFO field with the fieldname.
If you are actually getting the text "Get(ActiveFieldName)" inserted
into the field, then you must have it enclosed in quotes within your
insert calculation dialog. Just remove the quotes. But if you are
using it to determine a field that you are clicking on as a button (see
my solution above), then it will not know that whatever you are clicking
on is active. In fact, any other field can still be active with the
cursor inside it as you click on a button elsewhere on the layout (or in
another window altogether).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California

FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #5  
Old   
Dan
 
Posts: n/a

Default Re: clicking and if statements - 06-29-2005 , 08:49 AM



Hello Howard,

That's useful to know. I thought that clicking a field made it active, but
I see that is not the case if it is defined as a button.


<SNIP>
Quote:
But if you are
using it to determine a field that you are clicking on as a button
(see my solution above), then it will not know that whatever you are
clicking on is active. In fact, any other field can still be active
with the cursor inside it as you click on a button elsewhere on the
layout (or in another window altogether).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California
FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance




Reply With Quote
  #6  
Old   
pri
 
Posts: n/a

Default Re: clicking and if statements - 06-29-2005 , 11:11 AM



thank you guys! this was the exact feature i was looking for.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.