Page 1 of 4

Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 9:50 am
by new_user
Hello. I am looking for some help with an issue that I have not seen before when using an array to export the description field for user accounts. I can attached the entire script if needed although the arr used is below. On some users they have a long description for one reason or another and when writing out to a log file it breaks to a new line at some point in writing the description. I am writing 5-6 different attributes and description is last if that matters. Any help is appreciated.

The description attribute is multi-valued, but
' there is never more than one item in the array.
arrDesc = adoRecordset.Fields("description").Value
If IsNull(arrDesc) Then
strDescription = ""
Else
For Each strItem In arrDesc
strDescription = strItem
Next
End If

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 10:04 am
by jvierra
Take a look at you post. The text is unreadable.

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 10:05 am
by jvierra
Just get the fist item
desc = arrDesc(0)

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 10:13 am
by new_user
Sorry. The description arr I am using to get everything in the description field is:

' The description attribute is multi-valued, but
' there is never more than one item in the array.
arrDesc = adoRecordset.Fields("description").Value
If IsNull(arrDesc) Then
strDescription = ""
Else
For Each strItem In arrDesc
strDescription = strItem
Next
End If

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 12:36 pm
by jvierra
new_user wrote:Sorry. The description arr I am using to get everything in the description field is:

' The description attribute is multi-valued, but
' there is never more than one item in the array.
arrDesc = adoRecordset.Fields("description").Value
If IsNull(arrDesc) Then
strDescription = ""
Else
For Each strItem In arrDesc
strDescription = strItem
Next
End If
But that only gets the last element of the array. Try catting them.

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 12:46 pm
by new_user
Thank you for the reply not sure what you are referring to by catting them; how would that array to capture the description field contents change?

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 1:06 pm
by jvierra
Sorry - catenate them.

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 1:16 pm
by new_user
My code is attached to show how I am calling the array. and example of the output capture is also attached. This does work except if the data in the description field is very long. I am not clear regarding concatenating.

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 1:38 pm
by jvierra
It is used all of the time in every area of language and computers.

http://www.thefreedictionary.com/catenate

We "cat" something. In Unix there is even a command called "cat". It comes from "catenate". It has nothing to do with cute little kitties.

Re: Description field line breaks when exporting in vbscript

Posted: Tue Dec 31, 2013 1:40 pm
by jvierra
To be clearer. You are assigning an array element to a string. It needs to be catenated and not assigned.

There is a command that does that.

Do you need an example?