dbTalk Databases Forums  

Making a list from a Text field to a Repeating field

comp.databases.filemaker comp.databases.filemaker


Discuss Making a list from a Text field to a Repeating field in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sales@kustomkaps.com
 
Posts: n/a

Default Making a list from a Text field to a Repeating field - 07-16-2007 , 01:55 PM






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


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

Default Re: Making a list from a Text field to a Repeating field - 07-16-2007 , 02:29 PM






In article
<1184612136.822056.92120 (AT) n2g2000hse (DOT) googlegroups.com>sales@kustom
kaps.com wrote:

Quote:
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




Reply With Quote
  #3  
Old   
Bill Marriott
 
Posts: n/a

Default Re: Making a list from a Text field to a Repeating field - 07-17-2007 , 06:10 AM



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 (DOT) End> wrote

Quote:
In article
&lt;1184612136.822056.92120 (AT) n2g2000hse (DOT) googlegroups.com>sales@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





Reply With Quote
  #4  
Old   
Matt WIlls
 
Posts: n/a

Default Re: Making a list from a Text field to a Repeating field - 07-17-2007 , 02:43 PM



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 &lt;2tydndy2X6Y3PgHbnZ2dnUVZ_vGinZ2d (AT) comcast (DOT) com&gt;
"BillMarriott" &lt;wjm (AT) wjm (DOT) org&gt; wrote:

Quote:
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" &lt;Im (AT) Witz (DOT) End> wrote in message
news:nemoMon071607031812 (AT) news (DOT) verizon.net...
In article


&lt;1184612136.822056.92120 (AT) n2g2000hse (DOT) googlegroups.com>sales@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








Reply With Quote
  #5  
Old   
Bill Marriott
 
Posts: n/a

Default Re: Making a list from a Text field to a Repeating field - 07-17-2007 , 06:30 PM



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 (DOT) End> wrote

Quote:
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 &lt;2tydndy2X6Y3PgHbnZ2dnUVZ_vGinZ2d (AT) comcast (DOT) com
"BillMarriott" &lt;wjm (AT) wjm (DOT) 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)); "¶"; "")



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

Default Re: Making a list from a Text field to a Repeating field - 07-18-2007 , 02:25 AM




"Bill Marriott" <wjm (AT) wjm (DOT) org> schreef in bericht
news:nP6dnW1-vNg0zQDbnZ2dnUVZ_oG3nZ2d (AT) comcast (DOT) com...
Quote:
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




Reply With Quote
  #7  
Old   
Bill Marriott
 
Posts: n/a

Default Re: Making a list from a Text field to a Repeating field - 07-18-2007 , 05:02 AM



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 (DOT) nl> wrote

Quote:
"Bill Marriott" <wjm (AT) wjm (DOT) org> schreef in bericht
news:nP6dnW1-vNg0zQDbnZ2dnUVZ_oG3nZ2d (AT) comcast (DOT) 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




Reply With Quote
  #8  
Old   
Ursus
 
Posts: n/a

Default Re: Making a list from a Text field to a Repeating field - 07-18-2007 , 01:36 PM




"Bill Marriott" <wjm (AT) wjm (DOT) org> schreef in bericht
newsO2dnUaBWNYDeADbnZ2dnUVZ_tGonZ2d (AT) comcast (DOT) com...
Quote:
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




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.