Normal Topic Multi line field convert to 8 individual fields (Read 961 times)
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Multi line field convert to 8 individual fields
Feb 3rd, 2004 at 9:54pm
Print Post Print Post  
I had a multi line field in my old Q&A Database.

Field Name:  Team Members  (each name separate by a semi-colon)

We want to make individual fields for each team members.   My first thought was to export the Team members field to Excel; parse to 8 fields; import back to Sesame.  But I assume Sesame could do it too, CORRECT?
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Multi line field convert to 8 individual field
Reply #1 - Feb 3rd, 2004 at 10:49pm
Print Post Print Post  
I believe, you had a keyword field. You can import that in one element of Sesame form. Make seven more Layout elements in the form and a little programming in MassUpdate will do the job for you to parse the value.

Following Code will help you:

var VMembers as String = Members
var vFirst as String
var vSecond as String
var vThird as String
var vFourth as String
var vFifth as String
var vSixth as String
var vSeventh as String
var vEighth as String
var vSeparator as char = ";"


If @right(vMembers, 1) <> vSeparator then

     {
           vMembers = VMembers + vSeparator
     }


vFirst =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")

vSecond =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")

vThird =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")

vFourth =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")

vFifth =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")

vSixth =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")

vSeventh =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")

vEighth =  @Left (vMembers, (@in (VMembers, vSeparator) - 1))
vMembers = @replace (vMembers, @Left (vMembers, @in (VMembers, vSeparator)), "")


//WriteLn (vFirst, vSecond, vThird, vFourth, vFifth, vSixth, vSeventh, vEighth)

//Members is your present LE, the value of which you need to parse

//Reassign the value of various variables to your newly created LEs

MembersTeamA = vFirst
MembersTeamB = vSecond
MembersTeamC = vThird
MembersTeamD = vFourth
MembersTeamE = vFifth
MembersTeamF = vSixth
MembersTeamE = vSeventh
MembersTeamF = vEighth

I hope this helps.  The code seems long but it is the repeatition of the same code eight times.


« Last Edit: Feb 4th, 2004 at 6:07pm by Bharat_Naik »  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Multi line field convert to 8 individual field
Reply #2 - Feb 3rd, 2004 at 11:50pm
Print Post Print Post  
Even simpler than that. Work this out in Q&A before you import in Sesame. No programming involved.

step 1.  Backup database for safety
step 2.  Just one time export and remove the value from the field after export
step 3.  Make seven more fields in database
step 4.  Import

Step 2:  Export without Quote in standard ascii, No quotes around the text, field delimiter space, export only that keyword field

Step 4:  Import using field delimiter as ; (semicolon); No quotes, merging into those eight fields.

I believe this should work.



  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Multi line field convert to 8 individual field
Reply #3 - Feb 4th, 2004 at 6:49am
Print Post Print Post  
Jyellis, please note the modified post with added code in the suggestion of accomplishing the task with MassUpdate.   
« Last Edit: Feb 4th, 2004 at 6:14pm by Bharat_Naik »  
Back to top
 
IP Logged
 
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: Multi line field convert to 8 individual field
Reply #4 - Feb 4th, 2004 at 5:28pm
Print Post Print Post  
I created a form with the following elements:
Team Members
Team Member 1
Team Member 2
Team Member 3
....all the way to Team Member 8

Then I searched & sorted

Then in the spec window; Mass Updating; I double click on Team Members;entered your programming  I changed only the first variable line from Members to Team Members to match my field.  I tested it.

Then I ran the update.  It ran with no errors, but it did not populated the Team Member 1 - 8 fields.  What did I miss?
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Multi line field convert to 8 individual field
Reply #5 - Feb 4th, 2004 at 6:09pm
Print Post Print Post  
I do not think, you assigned the value of variables to your LEs.  I have included those statement in my earlier post. Please note... in the earlier post, change the LE in the code as necessary.


You will have to start all over as value of the keyfield must have vanished altogether.
  
Back to top
 
IP Logged
 
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: Multi line field convert to 8 individual field
Reply #6 - Feb 5th, 2004 at 4:15pm
Print Post Print Post  
MANY MANY THANKS!!!!! Cheesy
  
Back to top
 
IP Logged