shermund Posted April 23, 2012 Posted April 23, 2012 Hi, I have a table, which i have a field named "clientnames" i would like to copy its contents into another table. By using setfield, it only copies the first value. i have tried using an id in another field. using setfield with if function but it returns same result. i know i have to loop it somewhere but i really have no clue now because i can't seem to specific a value using an id to update into the new table. please shed some light on this. thanks regards
comment Posted April 23, 2012 Posted April 23, 2012 Could you provide a more detailed description of what you have to start with, and what are you trying to accomplish?
shermund Posted April 23, 2012 Author Posted April 23, 2012 i have a portal, which has enabled "allow add new records" i also have another table, which contains a field named "clientnames" that have multiple records i would like to add all the "clientnames" into the portal by using "go to last record and setfield via the field name" But it only adds the first record of "clientnames" only.
comment Posted April 23, 2012 Posted April 23, 2012 What I am having a hard time with is understanding what tables do you have. I understand there is a table of Clients, and another table of ??. In this table, each record has a return-separated (?) list of client names in a field? Also, is this a one-time conversion, or will you be doing this periodically?
shermund Posted April 23, 2012 Author Posted April 23, 2012 sorry for my poor english 1 table named "sales record", which has 3 fields, "clientnames", "date" and "salesperson" 1 table named "potential sales", which has also 2 fields, "clientnames2" and "salesperson" now i have a layout based on "sales record" which contains portal of "potential sales", linked by "salesperson". i am hoping to copy the all the entries of "clientnames" into "clientnames2". sorry sir for the confusion.
comment Posted April 23, 2012 Posted April 23, 2012 I am still a bit confused, so let me use a generic example with these two tables: Parent: • ParentID (auto-enter serial number) • ParentName • ChildNames (a return-separated list) Child: • ChildID (auto-enter serial number) • ParentID • ChildName The script to create a related Child record for each name in the ChildNames field would look like: Set Variable [$parentID ; Parent::ParentID ] Set Variable [ $childNames ; Parent::ChildNames ] Go to Layout [ Child ] Loop Set Variable [ $i ; $i + 1 ] Exit Loop If [ $i > ValueCoount ( $childNames ) ] New Record Set Field [ Child::ParentID ; $parentID ] Set Field [ Child::ChildName ; GetValue ( $childNames ; $i ) ] End Loop Go to Layout [ original layout ]
shermund Posted April 23, 2012 Author Posted April 23, 2012 i tried making one sample base on your example, i can't seem to get it working. the value count return as 1 as i tested it on the field. the use of $i is to identify the records, right?
Recommended Posts
This topic is 4666 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now