Description field line breaks when exporting in vbscript

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
new_user
Posts: 157
Joined: Wed May 30, 2007 7:01 am

Description field line breaks when exporting in vbscript

Post by new_user » Tue Dec 31, 2013 10:50 am

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

User avatar
jvierra
Posts: 12255
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Description field line breaks when exporting in vbscript

Post by jvierra » Tue Dec 31, 2013 11:04 am

Take a look at you post. The text is unreadable.

User avatar
jvierra
Posts: 12255
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Description field line breaks when exporting in vbscript

Post by jvierra » Tue Dec 31, 2013 11:05 am

Just get the fist item
desc = arrDesc(0)

User avatar
new_user
Posts: 157
Joined: Wed May 30, 2007 7:01 am

Re: Description field line breaks when exporting in vbscript

Post by new_user » Tue Dec 31, 2013 11:13 am

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

User avatar
jvierra
Posts: 12255
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Description field line breaks when exporting in vbscript

Post by jvierra » Tue Dec 31, 2013 1:36 pm

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.

User avatar
new_user
Posts: 157
Joined: Wed May 30, 2007 7:01 am

Re: Description field line breaks when exporting in vbscript

Post by new_user » Tue Dec 31, 2013 1:46 pm

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?

User avatar
jvierra
Posts: 12255
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Description field line breaks when exporting in vbscript

Post by jvierra » Tue Dec 31, 2013 2:06 pm

Sorry - catenate them.

User avatar
new_user
Posts: 157
Joined: Wed May 30, 2007 7:01 am

Re: Description field line breaks when exporting in vbscript

Post by new_user » Tue Dec 31, 2013 2:16 pm

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.
Attachments
Capture.JPG
Capture.JPG (65.18 KiB) Viewed 22977 times
LockedOut_.txt
(5.65 KiB) Downloaded 379 times

User avatar
jvierra
Posts: 12255
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Description field line breaks when exporting in vbscript

Post by jvierra » Tue Dec 31, 2013 2:38 pm

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.

User avatar
jvierra
Posts: 12255
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Description field line breaks when exporting in vbscript

Post by jvierra » Tue Dec 31, 2013 2:40 pm

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?

Locked