dbTalk Databases Forums  

Function to empty multiple fields

comp.databases.filemaker comp.databases.filemaker


Discuss Function to empty multiple fields in the comp.databases.filemaker forum.



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

Default Function to empty multiple fields - 08-17-2011 , 10:30 AM






I'm searching a personal function that I thought I saw some time ago but
can't find anymore, to empty a repeatingField.
If I'm right (mybe, it was a dream...), it was something like this:

ripetitionField = EmptyField (repeatingField, repetitionsList)

If ripetitionsList was empty, entry repeatingField was emptied,
otherwise only the repetitions matching a value in ripetitionsList was
emptied.
While I can't find it on internet, I tried to wrote it as recursive
function, but I can't get something usefull... Can someone help me to
find the function or to wrote it?

--
Per rispondere, togliere -NOSPAM- dall'indirizzo.

Reply With Quote
  #2  
Old   
Aladino
 
Posts: n/a

Default Re: Function to empty multiple fields - 08-17-2011 , 11:19 AM






Aladino <borgobello-NO (AT) SPAM-alice (DOT) it> wrote:

This is my attempt:

SvuotaCampoMultiplo (campoMultiplo; elencoRipetizioni)=

Let ([
$contatore=$contatore+1;
campoMultiplo=If (elencoRipetizioni="" or ContaRicorrenze (
elencoRipetizioni ; $contatore ); campoMultiplo[$contatore]="")
]);
If (contatore = Ultimo ( campoMultiplo ); campoMultiplo;
SvuotaCampoMultiplo (campoMultiplo; elencoRipetizioni) )

but don't work :-(

--
Per rispondere, togliere -NOSPAM- dall'indirizzo.

Reply With Quote
  #3  
Old   
Your Name
 
Posts: n/a

Default Re: Function to empty multiple fields - 08-17-2011 , 04:12 PM



In article <1k65pfd.x02oor1s9jhfqN%borgobello-NO (AT) SPAM-alice (DOT) it>,
borgobello-NO (AT) SPAM-alice (DOT) it (Aladino) wrote:

Quote:
Aladino <borgobello-NO (AT) SPAM-alice (DOT) it> wrote:

This is my attempt:

SvuotaCampoMultiplo (campoMultiplo; elencoRipetizioni)=

Let ([
$contatore=$contatore+1;
campoMultiplo=If (elencoRipetizioni="" or ContaRicorrenze (
elencoRipetizioni ; $contatore ); campoMultiplo[$contatore]="")
]);
If (contatore = Ultimo ( campoMultiplo ); campoMultiplo;
SvuotaCampoMultiplo (campoMultiplo; elencoRipetizioni) )

but don't work :-(
It doesn't need to be that complicated. Repeating Fields are usually not a
good idea since they are far too often a "pain in the sit upon" to use,
but luckily in this one instance there is a far easier way.

FileMaker includes a function for setting all repetitions of a Repeating
Field to the same data: the Extend() function. (Sorry, I don't know what
the Italian name for it is - it will be listed in the Repeating Field
Functions section of the Help File.)

The Help file says the parameter for the function is a non-Repeating
Field, but it could be worth trying a hard-coded value.
e.g.
Set Field [RepeatingField; Extend("")]

If the hard-coded value doesn't work, then you will have to create a
Global Field of the same data type as the Repeating Field (temporaily put
it on a Layout to make sure it is empty) to use instead - the Global Field
should NOT be a Repating Field.
e.g.
Set Field [RepeatingField; Extend(g_BlankField)]


Helpful Harry )

Reply With Quote
  #4  
Old   
Aladino
 
Posts: n/a

Default Re: Function to empty multiple fields - 08-17-2011 , 05:03 PM



Your Name <yourname (AT) yourisp (DOT) com> wrote:
Quote:
It doesn't need to be that complicated. Repeating Fields are usually not a
good idea since they are far too often a "pain in the sit upon" to use,
but luckily in this one instance there is a far easier way.
In any case, they semplfy very much my solution, and I won't do without
them, for now.
Quote:
FileMaker includes a function for setting all repetitions of a Repeating
Field to the same data: the Extend() function. (Sorry, I don't know what
the Italian name for it is - it will be listed in the Repeating Field
Functions section of the Help File.)
No problem.

The Help file says the parameter for the function is a non-Repeating
Field, but it could be worth trying a hard-coded value.
e.g.
Set Field [RepeatingField; Extend("")]
This didn't work (with my FMA9)
If the hard-coded value doesn't work, then you will have to create a
Global Field of the same data type as the Repeating Field (temporaily put
it on a Layout to make sure it is empty) to use instead - the Global Field
should NOT be a Repating Field.
e.g.
Set Field [RepeatingField; Extend(g_BlankField)]
I used a variable, that worked just fine. But this didn't alla that the
function should be able to do: empty only some repetitions.

elencoRipetizioni should be a list of repetetion to empty... only if
elencoRipetizioni is empty, the functions should delete all repetetion.

Exemple:

campoMultiplo[1]= a
campoMultiplo[2]= a
campoMultiplo[3]= a
campoMultiplo[4]= a
campoMultiplo[5]= a

campoMultiplo = SvuotaCampoMultiplo (campoMultiplo; 2򅼫)

campoMultiplo[1]= a
campoMultiplo[2]= ""
campoMultiplo[3]= ""
campoMultiplo[4]= a
campoMultiplo[5]= ""

--
Per rispondere, togliere -NOSPAM- dall'indirizzo.

Reply With Quote
  #5  
Old   
Your Name
 
Posts: n/a

Default Re: Function to empty multiple fields - 08-17-2011 , 08:16 PM



In article <1k664cx.7id1za2rlfggN%borgobello-NO (AT) SPAM-alice (DOT) it>,
borgobello-NO (AT) SPAM-alice (DOT) it (Aladino) wrote:
Quote:
I used a variable, that worked just fine. But this didn't alla that the
function should be able to do: empty only some repetitions.

elencoRipetizioni should be a list of repetetion to empty... only if
elencoRipetizioni is empty, the functions should delete all repetetion.

Exemple:

campoMultiplo[1]= a
campoMultiplo[2]= a
campoMultiplo[3]= a
campoMultiplo[4]= a
campoMultiplo[5]= a

campoMultiplo = SvuotaCampoMultiplo (campoMultiplo; 2򅼫)

campoMultiplo[1]= a
campoMultiplo[2]= ""
campoMultiplo[3]= ""
campoMultiplo[4]= a
campoMultiplo[5]= ""
Sorry, I though you were trying to clear (or set) all the repetions at once.

To do what you need above, you'll need a sub-Script that tests the values
and then sets the individual Repetitions.
e.g.

Main Script(s)
Set Field [g_ToClear; "2򅼫"]
Perform Script [ClearRepetitions]


ClearRepetitions Script
If [PatternCount(g_ToClear; "1") = 1]
Set Field [RepeatingField(1), ""]
End If
If [PatternCount(g_ToClear; "2") = 1]
Set Field [RepeatingField(2), ""]
End If
If [PatternCount(g_ToClear; "3") = 1]
Set Field [RepeatingField(3), ""]
End If
If [PatternCount(g_ToClear; "4") = 1]
Set Field [RepeatingField(4), ""]
End If
If [PatternCount(g_ToClear; "5") = 1]
Set Field [RepeatingField(5), ""]
End If


Depending on whether or not the version of FileMaker you're using can
dynamically set a Repetition via a Variable / Field value, then you could
do the same thing using recurring Script or Let function, but unless
you've got hundreds of Repetitions to test it's probably nor worth it.

Helpful Harry )

Reply With Quote
  #6  
Old   
Christoph Kaufmann
 
Posts: n/a

Default Re: Function to empty multiple fields - 08-18-2011 , 12:55 PM



Helpful Harry wrote:

Quote:
the Extend() function. (Sorry, I don't know what
the Italian name for it is - it will be listed in the Repeating Field
Functions section of the Help File.)
In any non-English copy of Filemaker, you can type or paste functions in
English and Filemaker will translate them.

Doesn't work the other way, however.
--
http://clk.ch

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.