If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Parsing a string

Started by wbarry123, 28 Sep 2011 01:19:02 PM

Previous topic - Next topic

wbarry123

I have a string like this:
12fda;565adf;adferfff;adsfsagf45af

I need to extract each part of the string (seperated by the semi-colon) into their own individual data item. 
Thank you in advance.

blom0344

Export and import the data into the database using the semicolon as separator. On SQL server this can be done through the wizards alone. When importing the number of columns needed is generated on the fly. You can then add the table to the model as a source..

wbarry123

I guess I was unclear.  This is what I am trying to do:
ID   Call Number                                      Call #1      Call #2    Call #3      Call #4   
1   12fda;565adf;adferfff;adsfsagf45af      12fda      565adf      adferfff      adsfsagf45af   

I have this data item (call Number) where the data in string is seperated by a semi-colon.  In report studio, I need to create new data Items (Call#1, Call#2...) where they extract the data between the semi-colons.      

blom0344

#3
No , I understand you perfectly   ;)
Reimporting the data into another table can do this for you as the semi-colon is used as data seperator

johangel

wbarry123, in onother live I used for this in Business Objects substring, lenght en position.
tomorrow at work I try to find the formula.
greetings,
Johan

johangel

Sorry my string was of an other format: "Txxx;Bxxx;Gxxx;Hxxx" I think you  can't use position and lenght.

colt

Assuming dataitem [call]='12fda;565adf;adferfff;adsfsagf45af'
then
[call#1]=SUBSTRING([call];1;POSITION(';';[call])-1)      (='12fda')
now we need to get the reststring without [call#1] 
[call#Rest1]=SUBSTRING([call];POSITION(';';[call])+1;character_length([call])-POSITION(';';[call]))      (=565adf;adferfff;adsfsagf45af')

Now you can go on parsing [call#Rest1] instead of [call] to get [call#2] and so on.