TaskNote truncating at 255 characters

W

Walter

With Project Server 2003, I am using VBA ADO to retrieve the TaskNote column
from table MSP_VIEW_PROJ_TASKS_STD. The data that is retrieved is truncated
at 255 characters. The TaskNote column is data type ntext. What can I do
to get around the truncation?

Thanks!

Walter
 
M

Mark Main

Project doesn't have the equivelent to a "memo" data type and so 255
characters is the limit for all the text type fields.

You'll have to (1) truncate, (2) split the memo text into multiple 255
character text fields (e.g. Text1, Text2, Text3), or (3) store it somewhere
else and reference to it (e.g. Access DB or text file).
 
W

Walter

The TaskNote column stores more than 255 characters. If you add a note
through Project to any task, you can add a lot more than 255 characters. We
use the note to record project summary information on task 0. I need to pull
this out automatically to a report. If we look at the database directly
through SQL tools, we can see all the text. But when it is retrieved via ADO
only 255 characters will come through.

Walter
 
M

Mark Main

I primarily use 2003 at work and 2007 at home. Task.Notes (I don't know what
TaskNote is) is a 255 character field. I don't know of a field in project
that stores over 255, and so I'm about to learn something new.
 
J

JulieS

Hi Walter,

Can you get the data from the MSP_Tasks.Task_RTF_Notes field found in
the MSP Tasks table? The PJDB.HTM file has some sample code under the
topic "Reading and writing RTF notes" (copied below)

Sub getRtf()
'This macro extracts RTF data from MSP_TASKS.TASK_RTF_NOTES. This
data can then be written
'to a file that can be opened with Microsoft Word or displayed in a
richedit control.

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String, rtf As String, cnString

'Open the MSP_TASKS table to look for TASK_RTF_NOTES
cnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\temp\MyProject.mpd"
sql = "select PROJ_ID, TASK_UID, TASK_RTF_NOTES " & _
"from MSP_TASKS " & _
"where TASK_RTF_NOTES is not null" 'can specify a specific
PROJ_ID and TASK_UID instead
cn.Open cnString
rs.Open sql, cn

'Enumerate across the recordset looking for notes
With rs
Do While Not .EOF
rtf = StrConv(.Fields("TASK_RTF_NOTES"), vbUnicode) ' Put
binary column data into text string
Debug.Print rtf
.MoveNext
Loop
.Close
End With
End Sub

I hope this helps. Let us know how you get along.

Julie
Project MVP

Visit http://project.mvps.org/ for the FAQs and additional information
about Microsoft Project
 
W

Walter

I got the code working with Project Server very quickly and I am returning
more than 255 characters - sort of. The string length is now more than 255
characters BUT its bringing back two bytes for each character so I'm not
actually getting more than 255 characters of my actual text back. Follow me?

I found one technote that stated that the ODBC connector looks at the first
eight rows in the database to determine the data type to use for each column.
If a text column doesn't have any text in the first eight rows that's over
255 characters, it uses a string. If rows beyond the first eight do have
text over 255 characters then it would blow up older drivers. The new one
may be truncacted it instead. I haven't found anything conclusive. I've
tried loading one of the first eight rows in the record set with more than
255 characters but it didn't make a difference so far.

Walter
 
J

JulieS

Hello Walter,

Sorry for the delay in replying. I don't run project server here so I'm
afraid I can't test the code against the MSP_View_Tasks_Std table. When
run against the MSP_Tasks table I am returning more than 255 characters.
I'm afraid I am *very* new to working with VBA and the db, so I amout of
ideas. Perhaps some new will weigh in with a better response than I can
offer.

Sorry I couldn't be of more help.

I hope this helps. Let us know how you get along.

Julie
Project MVP

Visit http://project.mvps.org/ for the FAQs and additional information
about Microsoft Project
 
W

Walter

I appreciate the ideas. I learned something although I didn't get my problem
solved.

I think my problem has to do with the ODBC connection to the SQL Server
database where Project Server stores the data. Hopefully I'll find a way to
get it!!!

Good luck!

Walter
 
S

Stephan Steiner

This one will work - I'm using it myself:

http://blogs.msdn.com/lduff/archive/2006/08/24/719222.aspx

I'm afraid you'll have to translate the code to VBA though but I suspect
you'll have some kind of RTF textbox in VBA, too.

I'm even using that mechanism in reverse to write task notes to project
server.

I figure the view you're accessing actually refers to the notes enterprise
text field (which is limited to 255 characters) - so there are actually two
notes fields (kinda confusing I know).

Regards
Stephan
 
Y

Yoav

I do not quite understand the C# code. Does anyone can translate to VB?
Thanks in advance,
Yoav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top