extracting data from a value list

  • Follow


Hi all,

What I'd like to do is extract the data from a value list of "categories"
and paste the data into a repetitive text field.

I'm able to extract the data in "categories" using the following:

Set Field ["valuelist.cat",
ValueListItems(status(CurrentFileName),"categorgies").

The result is my value list in text format separated by something (probably
tabs).

So, now I want to grab the first item and set into my category list,1 and
then category list,2 etc.

Any help would be appreciated.


Jon Davidson





0
Reply Jon 9/28/2003 11:41:51 PM

The list is separated with carriage returns ("�").  Placing the individual
items into a repeating field can be accomplished in two ways, by script or
by calculation.

By script, you go to a layout that has only your repeating field on it, with
all repetitions displayed.  Then you use a loop to populate each repetition
until you reach the end of the list.

Go To Layout [OnlyRepeatingTextField]
Go To Field [RepeatingTextField]
Set Field [GlobalText, ValueListItems( Status( CurrentFileName),
"categories") & "�"]
Loop
   Exit Loop If [GlobalText = ""]
   Paste Result [Select, Left( GlobalText, Position( GlobalText, "�", 1,
1) - 1)]
   Set Field [GlobalText, Right( GlobalText, Length( GlobalText) -
Position( GlobalText, "�", 1, 1))]
   Go To Next Field
End Loop
Exit Record / Request
Go To Layout [Original]

For the Paste Result (or Insert Calculated Result, depending upon your FM
version) script step, do not specify a field, just the result.



By calculation, you use a "helper" repeating field to keep count of where
you are in the list.

Helper (global, number, repeating)  -  as many repetitions as maximum number
of items in your list, each repetition filled with a number (1, 2, 3, etc.)

RepeatingCalcField (calculation, text) = Middle( ValueListItems( Status(
CurrentFileName), "categories") & "�", Position( ValueListItems( Status(
CurrentFileName), "categories") & "�", "�", 1, Helper - 1) + 1, Position(
ValueListItems( Status( CurrentFileName), "categories") & "�", "�", 1,
Helper) - Position( ValueListItems( Status( CurrentFileName), "categories")
& "�", "�", 1, Helper - 1) - 1)

"Jon Davidson" <jdavids1@twcny.rr.com> wrote in message
news:3lKdb.34023$TU3.25551@twister.nyroc.rr.com...
> Hi all,
>
> What I'd like to do is extract the data from a value list of "categories"
> and paste the data into a repetitive text field.
>
> I'm able to extract the data in "categories" using the following:
>
> Set Field ["valuelist.cat",
> ValueListItems(status(CurrentFileName),"categorgies").
>
> The result is my value list in text format separated by something
(probably
> tabs).
>
> So, now I want to grab the first item and set into my category list,1 and
> then category list,2 etc.
>
> Any help would be appreciated.
>
>
> Jon Davidson
>
>
>
>
>


0
Reply Glenn 9/29/2003 4:57:18 PM


Glenn's script and calc are best if your categories have a variable number
of words, but if they are all single word categories you could get by with
setting a field to the value list (using ValueListItems function) then using
an Index (global repeater numbered consecutively) and the Extend function:

MiddleWords(Extend(TextField), Index, 1)

I am a little puzzled though:  this must be one very long value list to make
simply cutting or pasting the values across not an option.  And if it is
that long, it is going to take just as much work to set up the scripts or
calcs suggested here (especially populating the Counter in Glen's offering
or the Index in mine).

A little more information might be helpful.

Bridget Eley

in article vngp3gfcsnoo32@corp.supernews.com, Glenn Schwandt at
schwandtgat@aoldot.com wrote on 30/9/03 2:57 AM:

> The list is separated with carriage returns ("�").  Placing the individual
> items into a repeating field can be accomplished in two ways, by script or
> by calculation.
> 
> By script, you go to a layout that has only your repeating field on it, with
> all repetitions displayed.  Then you use a loop to populate each repetition
> until you reach the end of the list.
> 
> Go To Layout [OnlyRepeatingTextField]
> Go To Field [RepeatingTextField]
> Set Field [GlobalText, ValueListItems( Status( CurrentFileName),
> "categories") & "�"]
> Loop
>  Exit Loop If [GlobalText = ""]
>  Paste Result [Select, Left( GlobalText, Position( GlobalText, "�", 1,
> 1) - 1)]
>  Set Field [GlobalText, Right( GlobalText, Length( GlobalText) -
> Position( GlobalText, "�", 1, 1))]
>  Go To Next Field
> End Loop
> Exit Record / Request
> Go To Layout [Original]
> 
> For the Paste Result (or Insert Calculated Result, depending upon your FM
> version) script step, do not specify a field, just the result.
> 
> 
> 
> By calculation, you use a "helper" repeating field to keep count of where
> you are in the list.
> 
> Helper (global, number, repeating)  -  as many repetitions as maximum number
> of items in your list, each repetition filled with a number (1, 2, 3, etc.)
> 
> RepeatingCalcField (calculation, text) = Middle( ValueListItems( Status(
> CurrentFileName), "categories") & "�", Position( ValueListItems( Status(
> CurrentFileName), "categories") & "�", "�", 1, Helper - 1) + 1, Position(
> ValueListItems( Status( CurrentFileName), "categories") & "�", "�", 1,
> Helper) - Position( ValueListItems( Status( CurrentFileName), "categories")
> & "�", "�", 1, Helper - 1) - 1)
> 
> "Jon Davidson" <jdavids1@twcny.rr.com> wrote in message
> news:3lKdb.34023$TU3.25551@twister.nyroc.rr.com...
>> Hi all,
>> 
>> What I'd like to do is extract the data from a value list of "categories"
>> and paste the data into a repetitive text field.
>> 
>> I'm able to extract the data in "categories" using the following:
>> 
>> Set Field ["valuelist.cat",
>> ValueListItems(status(CurrentFileName),"categorgies").
>> 
>> The result is my value list in text format separated by something
> (probably
>> tabs).
>> 
>> So, now I want to grab the first item and set into my category list,1 and
>> then category list,2 etc.
>> 
>> Any help would be appreciated.
>> 
>> 
>> Jon Davidson
>> 
>> 
>> 
>> 
>> 
> 
> 

-- 

(to email direct, replace "DOT" with "." and remove ".invalid")

0
Reply Bridget 9/29/2003 8:27:33 PM

2 Replies
197 Views

(page loaded in 0.08 seconds)


Reply: