How do a split a composite VTS record
Question ID: 105303
2
0

In a previous question, I told that I could store multiple data element is a single cell of a VTS Column. What does the code look like to separate the data elements into parameters?

Marked as spam
Posted by (Questions: 23, Answers: 4)
Asked on February 7, 2014 6:54 pm
51 views
Answers (1)
2
Private answer

After you have retrieve a single cell from a VTS column, create a function like the one below. Pass the record retrieved from the VTS retrieval to the function. The function then breaks apart the data elements and places them in parameters. For example the function below extracts, the UserId, Password, and Server From a composite record:

GetCompositeData(char * CompositeRecord)
{

/*** Take the Composite record and split it into it's three separate parts. The delimiter = '':'' ***/
char separators[] = '':'';
char * token;

/*** Use the strtok C function to break the Composite record at each '':'' ***/
token = (char *)strtok(CompositeRecord, separators); // Get the User ID
if (!token)
{
lr_output_message (''Composite record is invalid!'');
return( -1 );
}
lr_save_string(token, ''Userid'');

token = (char *)strtok(NULL, separators); // Get the Password
lr_save_string(token, ''Password'');

token = (char *)strtok(NULL, separators); // Get the first Server
lr_save_string(token, ''Server'');


return 0;
}

Marked as spam
Posted by (Questions: 4, Answers: 41)
Answered on February 7, 2014 6:57 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top