Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split String with X values 1

Status
Not open for further replies.

nilsbinnemans

Programmer
May 14, 2012
14
GB
Hi,

I need to split a string into multiple fields. The string contains multiple values and looks like this:
{String}: Value 1, Value 2, Value 3, ...
The maximum number of values is pretty much unlimited but I had never had more than 5 values up to now.
How can I split it looking like this:
Field 1: Value 1
Field 2: Value 2
Field 3: Value 3

Any ideas?

Thank you!
Nils
 
stringvar x := {table.field};
stringvar array y := split(x,",");
if ubound(y)>=3 then
trim(y[3])//for the third element.

Add a new formula like this for each element.

-LB
 
Is there a way that I could make an array that contains all the values?

Nils
 
The array (split(x,",") already contains all of the values. You just need to reference them separately. You can copy and paste to make this a simple process. If you wanted to reference them all at once, they you already have that in the original field. I guess I don't follow what you would want to do.

-LB
 
Hi lbass,

Sorry for the late reply. I'll try to make it more visual what I want to do:

I have two tables.
The first one containing a field called {Panel} and a field called {test}. In a report it would like this:

Group: PanelA
Details: test 1
test 2
test 3

Group: PanelB
Details: test 1
test 2
etc...

In the second table I have a field called {Panels}. I would like to link the tests to this field.
But if I would group {Panels} it could look like this:

Group: PanelA, PanelB

In that case the {test} would not show because (PanelA) is not linked to (PanelA, PanelB).

Hope this is clear.

greets,
Nils
 
No, still not clear. Please show what the report you'd like to generate would look like, and label the fields with this convention: {table.field}.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top