Making records from field's values. 
Author Message
 Making records from field's values.
Ok here is my problem, I have several "Style #" in 1 field like IP0053,
IK3563, IR3263... Each value are carriage return separeted. I want to create
as many records or "find requests" that I have values in this field.

In other words I want to put automaticaly each value in a separeted records
or "find requests"

Any easy way to do that?

Thank you.

P.S. Yes I have try with repeating field but my users doesn't like that. ;-/
And the portal but this is useless because I can't make it global.



Thu, 31 Jul 2003 04:41:40 GMT
 Making records from field's values.

Hi "Conveco"

Not quite sure of what you mean by 'create... records or "find
requests"'.  Are these two separate things you want to do or are you
referring to the New Record/Request script step?

If your objective is to find all records which have any of the values in
that field, the solution may be easier than you realise.  If the values
are always return separated and if the find request is an "or" type find
request, you can easily find all records with that value or values by
creating a self join relationship based on that field, then writing a
script which uses the Go to Related Record (show only related records)
script step.

If you are trying to achieve something else, could you post again with a
little more detail?

--
Bridget Eley


Quote:

> Ok here is my problem, I have several "Style #" in 1 field like IP0053,
> IK3563, IR3263... Each value are carriage return separeted. I want to create
> as many records or "find requests" that I have values in this field.

> In other words I want to put automaticaly each value in a separeted records
> or "find requests"

> Any easy way to do that?

> Thank you.

> P.S. Yes I have try with repeating field but my users doesn't like that. ;-/
> And the portal but this is useless because I can't make it global.



Thu, 31 Jul 2003 04:57:09 GMT
 Making records from field's values.
Just the other day I had to make a script/tool to take large lists of values
and parse them into a file; one value on record. Here's the script: I'll
call the destination field "Item" and the field that holds the list "List".

SetField["List","List & "?""]
*** this is just for consistency, with out a "?" at the end of List the loop
won't exit- on the other hand you can't have two "?", so maybe you need this
step maybe not.

Allow User Abort[on]
*** often a good idea with looping scripts

Loop
  If["Position(List , "?" , 1 , 1 ) > 0"]
  NewRecord/Request
  SetField["Item","Left(listItem , (Position(listItem, "?" , 1 , 1 ) -
1) )"]
  SetField["Item","Replace(listItem ,1,Position(listItem, "?" , 1 , 1 )
,"" )"]
  EndIf
  ExitLoopIf["List",= """]
EndLoop

--

C. Alex Lorda


Quote:
> Ok here is my problem, I have several "Style #" in 1 field like IP0053,
> IK3563, IR3263... Each value are carriage return separeted. I want to
create
> as many records or "find requests" that I have values in this field.

> In other words I want to put automaticaly each value in a separeted
records
> or "find requests"

> Any easy way to do that?

> Thank you.

> P.S. Yes I have try with repeating field but my users doesn't like that.
;-/
> And the portal but this is useless because I can't make it global.



Thu, 31 Jul 2003 08:55:10 GMT
 Making records from field's values.

Quote:
> Not quite sure of what you mean by 'create... records or "find
> requests"'.  Are these two separate things you want to do or are you
> referring to the New Record/Request script step?

> If your objective is to find all records which have any of the values in
> that field, the solution may be easier than you realise.  If the values
> are always return separated and if the find request is an "or" type find
> request, you can easily find all records with that value or values by
> creating a self join relationship based on that field, then writing a
> script which uses the Go to Related Record (show only related records)
> script step.

> If you are trying to achieve something else, could you post again with a
> little more detail?

> Bridget Eley

Hi Bridget! thanks for the reply.

I was referring to the New Record/Request script step. I'm sorry for the
confusion I forgot to mention that my field was global.

Ok in my database each records = 1 style and each style have their own
"style #" of course.

What I wanted is just let the user enter all these "style #" in one global
field then click on a button to find and print all the coresponding
style/records in the database. So you have to create as many "find requests"
that you have "style #" in the global field.

But C. Alex Lorda's resolved this problem with a prety good idea and wrote a
script's example. look at the reply.

Now the problem I have is how to inform the user when a "style #" is entered
in a multiple find requests but doesn't exist in the database? With FM5 when
you have only one find request and the srting doesn't exist in the database
the program always tell you "No records match this request" but when you
have more than one find request and one string you've entered dosen't exist
the program tell nothing. After the search I must inform the user wich
"style #" he gave that was not be found in the database.

Any help and comment on this issue will be very much appreciated

Thank you.



Fri, 01 Aug 2003 02:14:23 GMT
 Making records from field's values.

Quote:
> Just the other day I had to make a script/tool to take large lists of
values
> and parse them into a file; one value on record. Here's the script: I'll
> call the destination field "Item" and the field that holds the list
"List".

> SetField["List","List & "?""]
> *** this is just for consistency, with out a "?" at the end of List the
loop
> won't exit- on the other hand you can't have two "?", so maybe you need
this
> step maybe not.

> Allow User Abort[on]
> *** often a good idea with looping scripts

> Loop
>   If["Position(List , "?" , 1 , 1 ) > 0"]
>   NewRecord/Request
>   SetField["Item","Left(listItem , (Position(listItem, "?" , 1 , 1 ) -
> 1) )"]
>   SetField["Item","Replace(listItem ,1,Position(listItem, "?" , 1 , 1 )
> ,"" )"]
>   EndIf
>   ExitLoopIf["List",= """]
> EndLoop

> --

> C. Alex Lorda

Thank you very much  C. Alex. with your help I finaly resolved this problem.
At first I must admit that I was a little bit confuse with the last
"SetField" script step using the "listItem" string/field in your example but
rapidly resolve this. ;-)

Now the only problem I have is how to inform the user when a "style #" is
entered in a multiple find requests but doesn't exist in the database?  With
FM5 when you have more than one find request and one string you've entered
dosen't exist the program tell nothing unfortunatly.

After the search I must inform the user wich "style #" he gave that was not
be found in the database.

help on this issue will be very much appreciated

Thank you.



Fri, 01 Aug 2003 02:44:47 GMT
 Making records from field's values.
Hi  "Conveco"

I haven't had a chance to read C. Alex's response yet (I will) but the
method I posted will achieve the results you want very quickly and
efficiently.  Its also a good technique to know as it has other
applications.  Another possibility that might be of interest to you:  you
could format the field as a check box which shows all values (on a special
purpose layout) giving users a clear overview of all possible values -
this makes selecting multiple values a breeze.  They can check or uncheck
to their hearts content.

Re: your second query:  in the absence of a built in message for no
records found, you could create your own:

You would ordinarily start with Set Error Capture (On)  and follow the
Perform Find with If (Status (Current Error Code) = 401 (no records
found), a Show Message script step including a choice of actions, but if
FileMaker isn't providing its own error message, this might not work.  You
could try:

If (Status (CurrentFoundCount) = 0)
Beep
Show Message (There are no records matching the current search criteria.
Do you want to (list alternative actions)?)
Show message buttons "Action 1", "Action 2", "Cancel"
If (Status (CurrentMessageChoice) = 1
(Action 1)
Else
If (Status (CurrentMessageChoice) = 2
(Action 2)
Else
Find All  (or restore previous set, which would require marking of all
records in current set at beginning of script)
Exit Script
End If

--
Bridget Eley


Quote:

> Hi Bridget! thanks for the reply.

> I was referring to the New Record/Request script step. I'm sorry for the
> confusion I forgot to mention that my field was global.

> Ok in my database each records = 1 style and each style have their own
> "style #" of course.

> What I wanted is just let the user enter all these "style #" in one global
> field then click on a button to find and print all the coresponding
> style/records in the database. So you have to create as many "find requests"
> that you have "style #" in the global field.

> But C. Alex Lorda's resolved this problem with a prety good idea and wrote a
> script's example. look at the reply.

> Now the problem I have is how to inform the user when a "style #" is entered
> in a multiple find requests but doesn't exist in the database? With FM5 when
> you have only one find request and the srting doesn't exist in the database
> the program always tell you "No records match this request" but when you
> have more than one find request and one string you've entered dosen't exist
> the program tell nothing. After the search I must inform the user wich
> "style #" he gave that was not be found in the database.

> Any help and comment on this issue will be very much appreciated

> Thank you.


> > Not quite sure of what you mean by 'create... records or "find
> > requests"'.  Are these two separate things you want to do or are you
> > referring to the New Record/Request script step?

> > If your objective is to find all records which have any of the values in
> > that field, the solution may be easier than you realise.  If the values
> > are always return separated and if the find request is an "or" type find
> > request, you can easily find all records with that value or values by
> > creating a self join relationship based on that field, then writing a
> > script which uses the Go to Related Record (show only related records)
> > script step.

> > If you are trying to achieve something else, could you post again with a
> > little more detail?

> > Bridget Eley



Fri, 01 Aug 2003 05:13:04 GMT
 Making records from field's values.
What you need to do is to have a global field gRequest Amount
set by a Set Field Step at the beginning of the script. This Set Field
step will be determined by how many returns are in the global field
the user has entered the search in. Then after the self-join find,
Bridget was talking about, have the script check the found set
against the global field gRequest Amount. and report if they do
not match.

Vince

Sent via Deja.com
http://www.deja.com/



Fri, 01 Aug 2003 06:05:08 GMT
 Making records from field's values.
I'm sorry about my example's syntax- I pasted it from my files and for got
to change the "listItem" to "List". The first Set is to capture next value
in the global; the second Set is to remove the value just captured so the
loop will move on to the next.
I read your original question too fast and missed the part about the find...
Bridget has you covered there. However, if the style#'s that you are
searching are stored one value in one field, and one field to one record.
And you aren't worried about spelling errors between the contents of the
global field and the style# field. Then you might try a solution that uses
relationships and a multi-line key. A multi-line key is a match field in a
relationship that has multiple values separated by a carriage return
(exactly what your global is). Say the list global is called StartList and
the search field is called SyleNum. Create a global FoundList, an unsorted
calculation field TestMatch, and a global number field GeneralCounter. You
need a relationship between TestMatch and StyleNum "IsMatch", and a
relationship between FoundList and StyleNum "FindFound".

TestMatch = MiddleWords(StartList, GeneralCounter, 1 )

Use a modification of the script I gave you:

SetField["StartList","StartList & "?""]
SetField["GeneralCounter","0"]
Allow User Abort[on]
Loop
  If["not IsMatch::StyleNum" = """"]
  SetField["FoundList","FoundList & TestMatch & "?""]
  SetField["StartList","Replace(StartList,1,TestMatch & "?","" )"]
  Else
  SetField["GeneralCounter","GeneralCounter + 1"]
  EndIf
  ExitLoopIf["TestMatch",= """]
EndLoop
GotoRealatedRecord [Show, "FindFound"]

This should run fast, you don't have to enter find mode, and when it's over
the global StartList will be left with a list of all the values that were
not found. You can take the idea and play with it to suit your GUI needs. If
you do use it let me know how it works- or doesn't- I just pulled this off
the top of my head, it's not tested.

--

C. Alex Lorda


Quote:
> > Just the other day I had to make a script/tool to take large lists of
> values
> > and parse them into a file; one value on record. Here's the script: I'll
> > call the destination field "Item" and the field that holds the list
> "List".

> > SetField["List","List & "?""]
> > *** this is just for consistency, with out a "?" at the end of List the
> loop
> > won't exit- on the other hand you can't have two "?", so maybe you need
> this
> > step maybe not.

> > Allow User Abort[on]
> > *** often a good idea with looping scripts

> > Loop
> >   If["Position(List , "?" , 1 , 1 ) > 0"]
> >   NewRecord/Request
> >   SetField["Item","Left(listItem , (Position(listItem, "?" , 1 , 1 ) -
> > 1) )"]
> >   SetField["Item","Replace(listItem ,1,Position(listItem, "?" , 1 , 1 )
> > ,"" )"]
> >   EndIf
> >   ExitLoopIf["List",= """]
> > EndLoop

> > --

> > C. Alex Lorda

> Thank you very much  C. Alex. with your help I finaly resolved this
problem.
> At first I must admit that I was a little bit confuse with the last
> "SetField" script step using the "listItem" string/field in your example
but
> rapidly resolve this. ;-)

> Now the only problem I have is how to inform the user when a "style #" is
> entered in a multiple find requests but doesn't exist in the database?
With
> FM5 when you have more than one find request and one string you've entered
> dosen't exist the program tell nothing unfortunatly.

> After the search I must inform the user wich "style #" he gave that was
not
> be found in the database.

> help on this issue will be very much appreciated

> Thank you.



Fri, 01 Aug 2003 10:43:57 GMT
 Making records from field's values.
Just reread my post one bug:
SetField["GeneralCounter","0"]
should be:
SetField["GeneralCounter","1"]

--

C. Alex Lorda



Quote:
> I'm sorry about my example's syntax- I pasted it from my files and for got
> to change the "listItem" to "List". The first Set is to capture next value
> in the global; the second Set is to remove the value just captured so the
> loop will move on to the next.
> I read your original question too fast and missed the part about the
find...
> Bridget has you covered there. However, if the style#'s that you are
> searching are stored one value in one field, and one field to one record.
> And you aren't worried about spelling errors between the contents of the
> global field and the style# field. Then you might try a solution that uses
> relationships and a multi-line key. A multi-line key is a match field in a
> relationship that has multiple values separated by a carriage return
> (exactly what your global is). Say the list global is called StartList and
> the search field is called SyleNum. Create a global FoundList, an unsorted
> calculation field TestMatch, and a global number field GeneralCounter. You
> need a relationship between TestMatch and StyleNum "IsMatch", and a
> relationship between FoundList and StyleNum "FindFound".

> TestMatch = MiddleWords(StartList, GeneralCounter, 1 )

> Use a modification of the script I gave you:

> SetField["StartList","StartList & "?""]
> SetField["GeneralCounter","0"]
> Allow User Abort[on]
> Loop
>   If["not IsMatch::StyleNum" = """"]
>   SetField["FoundList","FoundList & TestMatch & "?""]
>   SetField["StartList","Replace(StartList,1,TestMatch & "?","" )"]
>   Else
>   SetField["GeneralCounter","GeneralCounter + 1"]
>   EndIf
>   ExitLoopIf["TestMatch",= """]
> EndLoop
> GotoRealatedRecord [Show, "FindFound"]

> This should run fast, you don't have to enter find mode, and when it's
over
> the global StartList will be left with a list of all the values that were
> not found. You can take the idea and play with it to suit your GUI needs.
If
> you do use it let me know how it works- or doesn't- I just pulled this off
> the top of my head, it's not tested.

> --

> C. Alex Lorda



> > > Just the other day I had to make a script/tool to take large lists of
> > values
> > > and parse them into a file; one value on record. Here's the script:
I'll
> > > call the destination field "Item" and the field that holds the list
> > "List".

> > > SetField["List","List & "?""]
> > > *** this is just for consistency, with out a "?" at the end of List
the
> > loop
> > > won't exit- on the other hand you can't have two "?", so maybe you
need
> > this
> > > step maybe not.

> > > Allow User Abort[on]
> > > *** often a good idea with looping scripts

> > > Loop
> > >   If["Position(List , "?" , 1 , 1 ) > 0"]
> > >   NewRecord/Request
> > >   SetField["Item","Left(listItem , (Position(listItem, "?" , 1 , 1 ) -
> > > 1) )"]
> > >   SetField["Item","Replace(listItem ,1,Position(listItem, "?" , 1 ,
1 )
> > > ,"" )"]
> > >   EndIf
> > >   ExitLoopIf["List",= """]
> > > EndLoop

> > > --

> > > C. Alex Lorda

> > Thank you very much  C. Alex. with your help I finaly resolved this
> problem.
> > At first I must admit that I was a little bit confuse with the last
> > "SetField" script step using the "listItem" string/field in your example
> but
> > rapidly resolve this. ;-)

> > Now the only problem I have is how to inform the user when a "style #"
is
> > entered in a multiple find requests but doesn't exist in the database?
> With
> > FM5 when you have more than one find request and one string you've
entered
> > dosen't exist the program tell nothing unfortunatly.

> > After the search I must inform the user wich "style #" he gave that was
> not
> > be found in the database.

> > help on this issue will be very much appreciated

> > Thank you.



Fri, 01 Aug 2003 10:52:44 GMT
 
 [ 9 post ] 

 Relevant Pages 

1. Incrementing Next Field's Value Based Upon Prior Field's Value

2. counting record only when field value is not equal to value of previous record

3. Joining tables / using another record's value if record doesn't exist

4. geting the last record's field value

5. doesn't recognize Null value from a field value

6. Field.value doesn't show value in control

7. Finding records(two records have a single field value that is the same)

8. Aggregating Boolean Expressions - SUM(([Field] = 'value') + ([Field] = 'value'))

9. help please! making new records with related fields

10. combobox's listindex = database fields' value

11. making a value selected in a select value list

12. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value


 
Powered by phpBB® Forum Software