Making a list from a Text field to a Repeating field
Hello, I am trying to find a way to pull information from a text
field to a repeating field. What I have is a list of colors in a text
field.
ie. red, royal blue, green, yellow, black
What I am trying to do is make a repeat field that has one color in
each field.
ie.
red
royal blue
green
yellow
black
Does anyone know of a simple way or complicated way to do this?
Currently I am doing these lists by hand. Not fun.
I have been able to create the list from the repeating field to the
text field but... the other way is beyond me.
should I have several blank fields and then look for each word from
the left? Is there a way to look for words between commas?
Pleast let me know,
Thank you
Tim
Re: Making a list from a Text field to a Repeating field
In article
<1184612136.822056.92120 [at] n2g2000hse.googlegroups.com>sales [at] kustom
kaps.com wrote:
> Hello, I am trying to find a way to pull information from a text
> field to a repeating field. What I have is a list of colors in a
> textfield.
> ie. red, royal blue, green, yellow, black
>
> What I am trying to do is make a repeat field that has one color
> ineach field.
>
> ie.
> red
> royal blue
> green
> yellow
> black
>
> Does anyone know of a simple way or complicated way to do
> this?Currently I am doing these lists by hand. Not fun.
>
> I have been able to create the list from the repeating field to
> thetext field but... the other way is beyond me.
>
> should I have several blank fields and then look for each word
> fromthe left? Is there a way to look for words between commas?
>
> Pleast let me know,
>
> Thank you
>
> Tim
>
>
Each return-separated item in a list is a value. You can identify each
individually using the GetValue function:
GetValue ( listOfValues ; valueNumber )
GetValue ( yourText ; 2 ) would be Royal Blue, GetValue ( yourText ; 4
) would be Yellow, etc.
Using a looped script, increment a script variable to identify both
the valueNumber and which repition a Set Field step would put it in.
Pseudo:
Set variable $Value to 1
Loop
Set Field RepField [ $Value ] to GetValue [ List ; $Value ]
Set variable $Value to $Value + 1
If $Value > ValueCount ( List }
exit script
End if
End Loop
Matt
Re: Making a list from a Text field to a Repeating field
You don't need a script.
Given:
yourTextField (text)
which contains a list of values separated by commas
Create:
myRepeatingValue (calculation, text result, repeating[n] values) =
Substitute(Trim(MiddleValues(
Substitute(Extend(yourTextField); ","; "¶");
Get(CalculationRepetitionNumber); 1)); "¶"; "")
Using Trim() ensures things work smoothly whether the commas have a space
following them or not. The outer Substitute() gets rid of the return
FileMaker thinks is nice to include in MiddleWords results.
"Matt WIlls" <Im [at] Witz.End> wrote in message
news:nemoMon071607031812 [at] news.verizon.net...
> In article
> <1184612136.822056.92120 [at] n2g2000hse.googlegroups.com>sales [at] kustom
> kaps.com wrote:
>
>> Hello, I am trying to find a way to pull information from a text
>> field to a repeating field. What I have is a list of colors in a
>> textfield.
>> ie. red, royal blue, green, yellow, black
>>
>> What I am trying to do is make a repeat field that has one color
>> ineach field.
>>
>> ie.
>> red
>> royal blue
>> green
>> yellow
>> black
>>
>> Does anyone know of a simple way or complicated way to do
>> this?Currently I am doing these lists by hand. Not fun.
>>
>> I have been able to create the list from the repeating field to
>> thetext field but... the other way is beyond me.
>>
>> should I have several blank fields and then look for each word
>> fromthe left? Is there a way to look for words between commas?
>>
>> Pleast let me know,
>>
>> Thank you
>>
>> Tim
>>
>>
> Each return-separated item in a list is a value. You can identify each
> individually using the GetValue function:
> GetValue ( listOfValues ; valueNumber )
>
> GetValue ( yourText ; 2 ) would be Royal Blue, GetValue ( yourText ; 4
> ) would be Yellow, etc.
> Using a looped script, increment a script variable to identify both
> the valueNumber and which repition a Set Field step would put it in.
> Pseudo:
>
> Set variable $Value to 1
> Loop
> Set Field RepField [ $Value ] to GetValue [ List ; $Value ]
> Set variable $Value to $Value + 1
> If $Value > ValueCount ( List }
> exit script
> End if
> End Loop
>
> Matt
>
>
Re: Making a list from a Text field to a Repeating field
Nice.
Playing with it, I find that it doesn't demand CSV; it worked on a
return-separated list as well, which would be good in conjunction with
the List function.
I tried it as a Set Field step in a script, and all that came back was
the first value, so there could be situations where a looping script
might be necessary.
Have you considered posting this as a CF at BrianDunning.com? There
doesn't appear to be anything similar there yet.
Matt
In article <2tydndy2X6Y3PgHbnZ2dnUVZ_vGinZ2d [at] comcast.com>
"BillMarriott" <wjm [at] wjm.org> wrote:
> You don't need a script.
>
> Given:
>
> yourTextField (text)
>
> which contains a list of values separated by commas
>
> Create:
>
> myRepeatingValue (calculation, text result, repeating[n] values) =
>
> Substitute(Trim(MiddleValues(
> Substitute(Extend(yourTextField); ","; "¶");
> Get(CalculationRepetitionNumber); 1)); "¶"; "")
>
>
> Using Trim() ensures things work smoothly whether the commas have a
> space following them or not. The outer Substitute() gets rid of the
> return FileMaker thinks is nice to include in MiddleWords results.
>
>
> "Matt WIlls" <Im [at] Witz.End> wrote in message
> news:nemoMon071607031812 [at] news.verizon.net...
>> In article
>>
>>
>> <1184612136.822056.92120 [at] n2g2000hse.googlegroups.com>sales [at] kust
>> om kaps.com wrote:
>>
>>> Hello, I am trying to find a way to pull information from a
>>> text field to a repeating field. What I have is a list of colors
>>> in a
>>> textfield.
>>> ie. red, royal blue, green, yellow, black
>>>
>>> What I am trying to do is make a repeat field that has one color
>>> ineach field.
>>>
>>> ie.
>>> red
>>> royal blue
>>> green
>>> yellow
>>> black
>>>
>>> Does anyone know of a simple way or complicated way to do
>>> this?Currently I am doing these lists by hand. Not fun.
>>>
>>> I have been able to create the list from the repeating field to
>>> thetext field but... the other way is beyond me.
>>>
>>> should I have several blank fields and then look for each word
>>> fromthe left? Is there a way to look for words between commas?
>>>
>>> Pleast let me know,
>>>
>>> Thank you
>>>
>>> Tim
>>>
>>>
>> Each return-separated item in a list is a value. You can identify
>> each individually using the GetValue function:
>> GetValue ( listOfValues ; valueNumber )
>>
>> GetValue ( yourText ; 2 ) would be Royal Blue, GetValue ( yourText
>> ; 4 ) would be Yellow, etc.
>> Using a looped script, increment a script variable to identify
>> both the valueNumber and which repition a Set Field step would put
>> it in. Pseudo:
>>
>> Set variable $Value to 1
>> Loop
>> Set Field RepField [ $Value ] to GetValue [ List ; $Value ]
>> Set variable $Value to $Value + 1
>> If $Value > ValueCount ( List }
>> exit script
>> End if
>> End Loop
>>
>> Matt
>>
>>
>
>
Re: Making a list from a Text field to a Repeating field
Thanks! The reason why it doesn't work in a script is the Set Field step is
always hard coded to a repetition, the default being 1. (Big limitation!)
And yes, any kind of delimiter will work, even spaces.
If I have the time I'll convert it to a custom function and post it :)
"Matt WIlls" <Im [at] Witz.End> wrote in message
news:nemoTue071707033215 [at] news.verizon.net...
> Nice.
>
> Playing with it, I find that it doesn't demand CSV; it worked on a
> return-separated list as well, which would be good in conjunction with
> the List function.
> I tried it as a Set Field step in a script, and all that came back was
> the first value, so there could be situations where a looping script
> might be necessary.
> Have you considered posting this as a CF at BrianDunning.com? There
> doesn't appear to be anything similar there yet.
> Matt
>
> In article <2tydndy2X6Y3PgHbnZ2dnUVZ_vGinZ2d [at] comcast.com>
> "BillMarriott" <wjm [at] wjm.org> wrote:
>
>> Given:
>>
>> yourTextField (text)
>>
>> which contains a list of values separated by commas
>>
>> Create:
>>
>> myRepeatingValue (calculation, text result, repeating[n] values) =
>>
>> Substitute(Trim(MiddleValues(
>> Substitute(Extend(yourTextField); ","; "¶");
>> Get(CalculationRepetitionNumber); 1)); "¶"; "")
Re: Making a list from a Text field to a Repeating field
"Bill Marriott" <wjm [at] wjm.org> schreef in bericht
news:nP6dnW1-vNg0zQDbnZ2dnUVZ_oG3nZ2d [at] comcast.com...
> Thanks! The reason why it doesn't work in a script is the Set Field step
> is always hard coded to a repetition, the default being 1. (Big
> limitation!) And yes, any kind of delimiter will work, even spaces.
>
Bill, I don't know which version you have, but using SetField with version
8.5 Adv I can enter the repetition number as the result of a calculation
(Which may hold any number of fields and/or variables). Which makes it not
hard coded, but flexible.
Keep Well, Ursus
Re: Making a list from a Text field to a Repeating field
What I mean by "hard coded" in this instance is that in the Set Field script
step, it must be a particular repetition, and not the entire set of them. My
formula relies on the Get(CalculationRepetitionNumber) function to populate
the entire field at once without the need of a looping script. The
calculation is "solid state" and always updates with a change to the source
field. Scripts are much slower and prone to become out of sync if you're not
careful.
It's true that in earlier versions of FileMaker the repetition number was
truly hard-coded; you couldn't specify it dynamically by a calculation (not
sure when that feature was added).
As for a workaround, one could possibly use Relookup to populate repeating
fields within a script without the use of looping.
"Ursus" <ursus.kirk [at] wanadoo.nl> wrote in message
news:469dc077$0$65140$dbd4f001 [at] news.wanadoo.nl...
>
> "Bill Marriott" <wjm [at] wjm.org> schreef in bericht
> news:nP6dnW1-vNg0zQDbnZ2dnUVZ_oG3nZ2d [at] comcast.com...
>> Thanks! The reason why it doesn't work in a script is the Set Field step
>> is always hard coded to a repetition, the default being 1. (Big
>> limitation!) And yes, any kind of delimiter will work, even spaces.
>>
>
> Bill, I don't know which version you have, but using SetField with version
> 8.5 Adv I can enter the repetition number as the result of a calculation
> (Which may hold any number of fields and/or variables). Which makes it not
> hard coded, but flexible.
>
> Keep Well, Ursus
>
Re: Making a list from a Text field to a Repeating field
"Bill Marriott" <wjm [at] wjm.org> schreef in bericht
news:pO2dnUaBWNYDeADbnZ2dnUVZ_tGonZ2d [at] comcast.com...
> What I mean by "hard coded" in this instance is that in the Set Field
> script step, it must be a particular repetition, and not the entire set of
> them. My formula relies on the Get(CalculationRepetitionNumber) function
> to populate the entire field at once without the need of a looping script.
> The calculation is "solid state" and always updates with a change to the
> source field. Scripts are much slower and prone to become out of sync if
> you're not careful.
>
> It's true that in earlier versions of FileMaker the repetition number was
> truly hard-coded; you couldn't specify it dynamically by a calculation
> (not sure when that feature was added).
>
> As for a workaround, one could possibly use Relookup to populate repeating
> fields within a script without the use of looping.
>
Or create a custom function that calls itself until it runs out of
repetitions to fill. Almost instantanious.
Keep Well, Ursus