IT Asset Manager / Connect-IT User Discussions
cancel

Convert string values to array using HP Connect-it

SOLVED
Go to solution
Honored Contributor.. NeoJax Honored Contributor..
Honored Contributor..

Convert string values to array using HP Connect-it

Hi All,

I'm struggling with an issue to pass the values from the string to an aaray,

 

Dim Mainstring
Dim Mystr
Mainstring = "value1~value2~value3"
Mystr = Replace(Mainstring ,"~","" & Chr(13) & Chr(10) &"")
RetVal = Mystr

The value is inserting in MF Service Manager array field as:

 

value1value2value3

The requiement is to put the values in the MF Service Manager array field is:

value1
value2
value3

Please suggest I have tried multiple ways but none working, have also refered to below urls:

Connect-It-parsing-crlf      &

 Convert-string-to-array-via-Connect-It

Please provide some valuable suggestions

Thanks

Neo

 

1 ACCEPTED SOLUTION

Accepted Solutions
Mark Cullen_1 Acclaimed Contributor.
Acclaimed Contributor.
Solution

Re: Convert string values to array using HP Connect-it

Dim Mainstring
Dim Mystr
Dim i

Mainstring = "value1~value2~value3"

FOR i = 1 TO CountValues(Mainstring,"~","\")
   Mystr = Mystr & ExtractValue(Mainstring,"~","\") & Chr(13) & Chr(10)
NEXT i

RetVal = Mystr

4 REPLIES
Mark Cullen_1 Acclaimed Contributor.
Acclaimed Contributor.
Solution

Re: Convert string values to array using HP Connect-it

Dim Mainstring
Dim Mystr
Dim i

Mainstring = "value1~value2~value3"

FOR i = 1 TO CountValues(Mainstring,"~","\")
   Mystr = Mystr & ExtractValue(Mainstring,"~","\") & Chr(13) & Chr(10)
NEXT i

RetVal = Mystr

Honored Contributor.. NeoJax Honored Contributor..
Honored Contributor..

Re: Convert string values to array using HP Connect-it

Hi  Mark Cullen_1 

Many Thanks for your response, The logic in the code looks pretty much fine & should work, but unfortunatley it is not wokring,

Still the values are coming a plain string format, please refer to screenshot below:

CIT-1.JPGMF SM Capability Word ArrayCIT-Mapping.JPGConnect-it Mapping

Please Suggest

Thanks a gaian for your assistance

Neo

Mark Cullen_1 Acclaimed Contributor.
Acclaimed Contributor.

Re: Convert string values to array using HP Connect-it

Thanks for the mapping screenshot.  You may want to review Collection mapping in the help.  There should also be something related with string to collection.  Good luck.

Honored Contributor.. NeoJax Honored Contributor..
Honored Contributor..

Re: Convert string values to array using HP Connect-it

Thanks a lot Mark Cullen_1

The code is working fine, in the collection mapping , the array field was not accepting the values, I tried creating a custom array field & pushed the values in teh custom array in order to test the code, in the custom field array field was able to acept the values.

Thanks again for your assistance.

Cheers

Neo