Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.filemaker > #2664 > unrolled thread
| Started by | Nelson <nelson@nowhere.com> |
|---|---|
| First post | 2016-08-09 15:06 -0400 |
| Last post | 2016-08-14 20:51 +0200 |
| Articles | 12 — 6 participants |
Back to article view | Back to comp.databases.filemaker
Script to Increment an arbitrary Field Nelson <nelson@nowhere.com> - 2016-08-09 15:06 -0400
Re: Script to Increment an arbitrary Field Helpful Harry <HelpfulHarry@BusyWorking.com> - 2016-08-10 08:59 +1200
Re: Script to Increment an arbitrary Field Nelson <nelson@nowhere.com> - 2016-08-10 12:00 -0400
Re: Script to Increment an arbitrary Field clkaufmann@gmx.ch (Christoph Kaufmann) - 2016-08-11 09:19 +0200
Re: Script to Increment an arbitrary Field Ursus <ursus.kirk@ziggo.nl> - 2016-08-11 09:51 +0200
Re: Script to Increment an arbitrary Field Nelson <nelson@nowhere.com> - 2016-08-12 06:18 -0400
Re: Script to Increment an arbitrary Field ursus <ursus.kirk@gmail.com> - 2016-08-12 13:12 +0200
Re: Script to Increment an arbitrary Field Nelson <nelson@nowhere.com> - 2016-08-12 09:53 -0400
Re: Script to Increment an arbitrary Field Helpful Harry <HelpfulHarry@BusyWorking.com> - 2016-08-13 09:48 +1200
Re: Script to Increment an arbitrary Field Martin Τrautmann <t-usenet@gmx.net> - 2016-08-14 12:56 +0000
Re: Script to Increment an arbitrary Field Nelson <nelson@nowhere.com> - 2016-08-12 06:14 -0400
Re: Script to Increment an arbitrary Field clkaufmann@gmx.ch (Christoph Kaufmann) - 2016-08-14 20:51 +0200
| From | Nelson <nelson@nowhere.com> |
|---|---|
| Date | 2016-08-09 15:06 -0400 |
| Subject | Script to Increment an arbitrary Field |
| Message-ID | <0001HW.D3CFA2020811C44BB02919BF@news.astraweb.com> |
I'd like to format a field as a button which when clicked will increment the underlying field by one. I can see how to do it if I specify the field to be incremented. I can't figure out how to make a generic script to do this which I can apply to an arbitrary field. The problem is that hovering over the button doesn't make the corresponding field active. Any ideas how to do this? -- Nelson
[toc] | [next] | [standalone]
| From | Helpful Harry <HelpfulHarry@BusyWorking.com> |
|---|---|
| Date | 2016-08-10 08:59 +1200 |
| Message-ID | <100820160859573113%HelpfulHarry@BusyWorking.com> |
| In reply to | #2664 |
In article <0001HW.D3CFA2020811C44BB02919BF@news.astraweb.com>, Nelson
<nelson@nowhere.com> wrote:
>
> I'd like to format a field as a button which when clicked will
> increment the underlying field by one. I can see how to do it if I
> specify the field to be incremented. I can't figure out how to make a
> generic script to do this which I can apply to an arbitrary field. The
> problem is that hovering over the button doesn't make the corresponding
> field active.
>
> Any ideas how to do this?
It may depend on the version of FileMaker Pro you're using.
In early versions it simple isn't possible. You would have to create a
separate Button and Script for each Field.
In newer versions you can use Script Parameters to pass which Button
has been clicked to the Script, but you may still need a set of "If
Then" statements to work out which Field to increment from the
Parameter. I haven't got any way to check, but if you set that
Parameter from each Button as the Field's actual name, then you MIGHT
be able to use one command along the lines of:
Set Field [ Get(ScriptParameter); Get(ScriptParameter) + 1]
BUT,
clicking the Field to increment its value is not a very good usability
design since it's far too easy to click the wrong Field by accident.
You're probably better off with a set of "+" and "-" Buttons next to
each Field so the user can both increment and decrement the Field's
value.
Helpful Harry :o)
[toc] | [prev] | [next] | [standalone]
| From | Nelson <nelson@nowhere.com> |
|---|---|
| Date | 2016-08-10 12:00 -0400 |
| Message-ID | <0001HW.D3D0C7E30856A47BB01029BF@news.astraweb.com> |
| In reply to | #2665 |
On Tue, 9 Aug 2016 16:59:57 -0400, Helpful Harry wrote (in article <100820160859573113%HelpfulHarry@BusyWorking.com>): > In article <0001HW.D3CFA2020811C44BB02919BF@news.astraweb.com>, Nelson > <nelson@nowhere.com> wrote: >> >> I'd like to format a field as a button which when clicked will >> increment the underlying field by one. I can see how to do it if I >> specify the field to be incremented. I can't figure out how to make a >> generic script to do this which I can apply to an arbitrary field. The >> problem is that hovering over the button doesn't make the corresponding >> field active. >> >> Any ideas how to do this? > > It may depend on the version of FileMaker Pro you're using. > > In early versions it simple isn't possible. You would have to create a > separate Button and Script for each Field. > > In newer versions you can use Script Parameters to pass which Button > has been clicked to the Script, but you may still need a set of "If > Then" statements to work out which Field to increment from the > Parameter. I haven't got any way to check, but if you set that > Parameter from each Button as the Field's actual name, then you MIGHT > be able to use one command along the lines of: > Set Field [ Get(ScriptParameter); Get(ScriptParameter) + 1] Yeah, I do't see any way to avoid multiple scripts. A series of "If-Then's" just looks to kludgey even if it can be done. And every time you want to add a field you'd have to change the script. > BUT, > clicking the Field to increment its value is not a very good usability > design since it's far too easy to click the wrong Field by accident. > You're probably better off with a set of "+" and "-" Buttons next to > each Field so the user can both increment and decrement the Field's > value. I spoke with the only user (me) and he finds it a superior usability design. What can I say? The customer is always right :) -- Nelson
[toc] | [prev] | [next] | [standalone]
| From | clkaufmann@gmx.ch (Christoph Kaufmann) |
|---|---|
| Date | 2016-08-11 09:19 +0200 |
| Message-ID | <1mrt89w.k4rd3u1cxowv4N%clkaufmann@gmx.ch> |
| In reply to | #2666 |
Nelson <nelson@nowhere.com> wrote: > I do't see any way to avoid multiple scripts. The "Set field by name" script step was introduced with Filemaker Pro 10. You need but one script to set a field with a value. Use parameters for Field name, content, commit or not, refresh or not, where to go next, and script result (which is important if the script is called by a trigger). You'll want to pass the field name with the GetFieldName function rather than hard code it. > I spoke with the only user (me) and he finds it a superior usability > design. What can I say? The customer is always right :) By experience, the customer will want something different six months from now. And then, of course, he's right too. The developer inside you knows that all along.
[toc] | [prev] | [next] | [standalone]
| From | Ursus <ursus.kirk@ziggo.nl> |
|---|---|
| Date | 2016-08-11 09:51 +0200 |
| Message-ID | <b0550$57ac2e9e$53559afc$20447@news.ziggo.nl> |
| In reply to | #2667 |
Op 11-8-2016 om 09:19 schreef Christoph Kaufmann: > Nelson <nelson@nowhere.com> wrote: > >> I do't see any way to avoid multiple scripts. > > The "Set field by name" script step was introduced with Filemaker Pro > 10. You need but one script to set a field with a value. Use parameters > for Field name, content, commit or not, refresh or not, where to go > next, and script result (which is important if the script is called by a > trigger). > > You'll want to pass the field name with the GetFieldName function rather > than hard code it. > >> I spoke with the only user (me) and he finds it a superior usability >> design. What can I say? The customer is always right :) > > By experience, the customer will want something different six months > from now. And then, of course, he's right too. The developer inside you > knows that all along. > PseudoPseudoCode You number your fields (instead of naming them field1 _ fieldx) just 1 and 2 etc. GetFieldName as number SetField(number+1) as NewValue Ursus
[toc] | [prev] | [next] | [standalone]
| From | Nelson <nelson@nowhere.com> |
|---|---|
| Date | 2016-08-12 06:18 -0400 |
| Message-ID | <0001HW.D3D31AC308E20FE2B02919BF@news.astraweb.com> |
| In reply to | #2668 |
On Thu, 11 Aug 2016 03:51:56 -0400, Ursus wrote (in article <b0550$57ac2e9e$53559afc$20447@news.ziggo.nl>): > Op 11-8-2016 om 09:19 schreef Christoph Kaufmann: >> Nelson <nelson@nowhere.com> wrote: >> >>> I do't see any way to avoid multiple scripts. >> >> The "Set field by name" script step was introduced with Filemaker Pro >> 10. You need but one script to set a field with a value. Use parameters >> for Field name, content, commit or not, refresh or not, where to go >> next, and script result (which is important if the script is called by a >> trigger). >> >> You'll want to pass the field name with the GetFieldName function rather >> than hard code it. >> >>> I spoke with the only user (me) and he finds it a superior usability >>> design. What can I say? The customer is always right :) >> >> By experience, the customer will want something different six months >> from now. And then, of course, he's right too. The developer inside you >> knows that all along. >> > PseudoPseudoCode > You number your fields (instead of naming them field1 _ fieldx) just 1 > and 2 etc. > GetFieldName as number > SetField(number+1) as NewValue > > Ursus > The problem is that the button doesn't activate the associated field so any of the functions which operate on the active field such as GetFieldName or GetFieldName as number don't reference the desired field. -- Nelson
[toc] | [prev] | [next] | [standalone]
| From | ursus <ursus.kirk@gmail.com> |
|---|---|
| Date | 2016-08-12 13:12 +0200 |
| Message-ID | <nokaur$2ir$1@dont-email.me> |
| In reply to | #2670 |
>>> >> PseudoPseudoCode >> You number your fields (instead of naming them field1 _ fieldx) just 1 >> and 2 etc. >> GetFieldName as number >> SetField(number+1) as NewValue >> >> Ursus >> > > The problem is that the button doesn't activate the associated field so > any of the functions which operate on the active field such as > GetFieldName or GetFieldName as number don't reference the desired > field. > The button can be named as well. BUt why do you need a field to act as a button in the first place? If it is because you need to see the contents of the field on the button then there are other ways to accomplish that. like create and name a button. then put your field on top if it. Group them and assign a script to the group. parse the name of the button to the script as a variable. -- Keep well, Ursus
[toc] | [prev] | [next] | [standalone]
| From | Nelson <nelson@nowhere.com> |
|---|---|
| Date | 2016-08-12 09:53 -0400 |
| Message-ID | <0001HW.D3D34D2D08EDE0D2B01029BF@news.astraweb.com> |
| In reply to | #2671 |
On Fri, 12 Aug 2016 07:12:26 -0400, ursus wrote (in article <nokaur$2ir$1@dont-email.me>): > >>>> >>> PseudoPseudoCode >>> You number your fields (instead of naming them field1 _ fieldx) just 1 >>> and 2 etc. >>> GetFieldName as number >>> SetField(number+1) as NewValue >>> >>> Ursus >>> >> >> The problem is that the button doesn't activate the associated field so >> any of the functions which operate on the active field such as >> GetFieldName or GetFieldName as number don't reference the desired >> field. >> > > The button can be named as well. BUt why do you need a field to act as a > button in the first place? If it is because you need to see the contents > of the field on the button then there are other ways to accomplish that. > like create and name a button. then put your field on top if it. Group > them and assign a script to the group. parse the name of the button to > the script as a variable. I have several fields which are just counters starting at 0. I want them to increment when I click on them rather than have to manually enter the next integer. I could use a script trigger like "On Object Enter", but that wouldn't allow me to change my mind or decrement the field. Plus I could make the field active accidentally. The way I have it set up now, the field is formatted as a button. Clicking on it increments the value, Option-Clicking on it decrements the value. Works for me. The script associated with the button has to have the field name hard coded into it so I have to have a different script for each counter. Putting a button next to the field just clutters up the interface and that button has the same issue of needing the field name. Not a big deal but I was looking for some sort of generic solution. -- Nelson
[toc] | [prev] | [next] | [standalone]
| From | Helpful Harry <HelpfulHarry@BusyWorking.com> |
|---|---|
| Date | 2016-08-13 09:48 +1200 |
| Message-ID | <130820160948389357%HelpfulHarry@BusyWorking.com> |
| In reply to | #2672 |
In article <0001HW.D3D34D2D08EDE0D2B01029BF@news.astraweb.com>, Nelson <nelson@nowhere.com> wrote: > On Fri, 12 Aug 2016 07:12:26 -0400, ursus wrote > (in article <nokaur$2ir$1@dont-email.me>): > >>> > >>> PseudoPseudoCode > >>> You number your fields (instead of naming them field1 _ fieldx) just 1 > >>> and 2 etc. > >>> GetFieldName as number > >>> SetField(number+1) as NewValue > >> > >> The problem is that the button doesn't activate the associated field so > >> any of the functions which operate on the active field such as > >> GetFieldName or GetFieldName as number don't reference the desired > >> field. > > > > The button can be named as well. BUt why do you need a field to act as a > > button in the first place? If it is because you need to see the contents > > of the field on the button then there are other ways to accomplish that. > > like create and name a button. then put your field on top if it. Group > > them and assign a script to the group. parse the name of the button to > > the script as a variable. > > I have several fields which are just counters starting at 0. I want > them to increment when I click on them rather than have to manually > enter the next integer. I could use a script trigger like "On Object > Enter", but that wouldn't allow me to change my mind or decrement the > field. Plus I could make the field active accidentally. > > The way I have it set up now, the field is formatted as a button. > Clicking on it increments the value, Option-Clicking on it decrements > the value. Works for me. The script associated with the button has to > have the field name hard coded into it so I have to have a different > script for each counter. Putting a button next to the field just > clutters up the interface and that button has the same issue of needing > the field name. Having a Field as a Button (or a Button layered over Field) is that you then can't click into the Field itself. Either your Script will also need to select the Field or you'll need a second copy of the Field (perhaps on a different Layout) that can be clicked into so that you can manually edit the data if needed. That's why it's usually best to have something like a "+" and "-" Button next to the Field or, depending on how it's used, automating the increment as an auto-enter Field or Script associated with a function (e.g. "New Record"). > Not a big deal but I was looking for some sort of generic solution. I think the only way is to pass the Field name as a parameter, which means hardcoding the Field names into the Button definitions ... but since they're attached to the appropriate Button / Field anyway, I don't think that matters too much (as long as you remember to change it if you duplicate a Field / Button and change which Field it uses). Helpful Harry :o)
[toc] | [prev] | [next] | [standalone]
| From | Martin Τrautmann <t-usenet@gmx.net> |
|---|---|
| Date | 2016-08-14 12:56 +0000 |
| Message-ID | <slrnnr0qj0.2kr.t-usenet@ID-685.user.individual.de> |
| In reply to | #2673 |
On Sat, 13 Aug 2016 09:48:38 +1200, Helpful Harry wrote: > Having a Field as a Button (or a Button layered over Field) is that you > then can't click into the Field itself. But you can pass a parameter to the script to go to this field. It's the only parameter you need if you use it to increment the value within this field, but you can use the parameter to increment the field without entering it, too. - Martin
[toc] | [prev] | [next] | [standalone]
| From | Nelson <nelson@nowhere.com> |
|---|---|
| Date | 2016-08-12 06:14 -0400 |
| Message-ID | <0001HW.D3D319BF08E1D2F9B02919BF@news.astraweb.com> |
| In reply to | #2667 |
On Thu, 11 Aug 2016 03:19:25 -0400, Christoph Kaufmann wrote (in article <1mrt89w.k4rd3u1cxowv4N%clkaufmann@gmx.ch>): > Nelson <nelson@nowhere.com> wrote: > >> I do't see any way to avoid multiple scripts. > > The "Set field by name" script step was introduced with Filemaker Pro > 10. You need but one script to set a field with a value. Use parameters > for Field name, content, commit or not, refresh or not, where to go > next, and script result (which is important if the script is called by a > trigger). > > You'll want to pass the field name with the GetFieldName function rather > than hard code it. > >> I spoke with the only user (me) and he finds it a superior usability >> design. What can I say? The customer is always right :) > > By experience, the customer will want something different six months > from now. And then, of course, he's right too. The developer inside you > knows that all along. I am using the "Set field by name" script step. But that requires you know the name. "GetFieldName" requires that the field be active. When the field is formatted as a button, placing the cursor over it does not make it active hence you can't get the name or you get the wrong name. What I want is something like "Set the field which has this button or script associated with it" so that I can have one generic script which can then be then be assigned via a button format to any arbitrary field without knowing it's name in advance. Format an arbitrary field as a button, assign the script to it, then click on the field to increment by one, option-click to decrement by one. I don't think it's possible. -- Nelson
[toc] | [prev] | [next] | [standalone]
| From | clkaufmann@gmx.ch (Christoph Kaufmann) |
|---|---|
| Date | 2016-08-14 20:51 +0200 |
| Message-ID | <1mrzobb.1mjxtl91hv8w8iN%clkaufmann@gmx.ch> |
| In reply to | #2669 |
> I am using the "Set field by name" script step. But that requires you > know the name. That's way you pass a script parameter. > "GetFieldName" requires that the field be active. No. > What I want is something like "Set the field which has this button or > script associated with it" That's way you pass a script parameter. > Format an arbitrary field as a button, assign the script to it, then > click on the field to increment by one, option-click to decrement by > one. > > I don't think it's possible. Did I mention script parameters? Try this: getfieldname ( insert required field here ) & ¶ & Get ( ActiveModifierKeys ) In the script, retrieve the parameter with Getvalue ( Get ( ScriptParameter ) ; 1 ) and Getvalue ( Get ( ScriptParameter ) ; 2 ) Option key was pressed if Get ( ActiveModifierKeys ) = 8
[toc] | [prev] | [standalone]
Back to top | Article view | comp.databases.filemaker
csiph-web