Attachments into Variables

markjde

Active Member
Does anyone know of a BSFN that I can use or a process that I can develop
that will retrieve the a specific character length of text from an
attachment?

Mark

7332 SP 11.3 NT SQL 7.0
 

amwalshjde

Well Known Member
Mark-

Here is some code that I use to do this. I wanted to pull out the text, and seperate it by line (using the carrige return char as a seperator). You can use any seperator you want.

0070 //
0071 //
0072 // Do Note Processing
0073 //
0074 VA evt_PMGSequenceNumber = "1"
0075 Media Objects(GT4201A, <Get Text>, VA evt_PMGLongField, BC Document (Order No, Invoice, etc.) (F47046), BC Order Type (F47046), BC Order Company (Order Number) (F47046))
0076 If VA evt_PMGLongField is equal to <Blank>
0077 Media Objects(GT4714, <Get Text>, VA evt_PMGLongField, F4714, BC Document (Order No, Invoice, etc.) (F47046), BC Order Type (F47046), BC Order Company (Order Number) (F47046))
0078 End If
0079 VA evt_ASCIValue = "10"
0080 COnvert the ASCI value to the Char representation
VA evt_CarrigeReturn <- cEverestEventPoint01
VA evt_ASCIValue -> mnDocumentOrderInvoiceE
0081 Finds a char position in a string
VA evt_PMGLongField -> szString
VA evt_CarrigeReturn -> cCharToFind
VA evt_StartPosition -> mnStartingPosition
VA evt_positionFound <- mnPositionFound
0082 While VA evt_positionFound is greater than <Zero>
0083 VA evt_characterstoread = [VA evt_positionFound]-[VA evt_StartPosition]
0084 VA evt_PMGNotes = substr([VA evt_PMGLongField],[VA evt_StartPosition],[VA evt_characterstoread])
0085 VA evt_PMGSequenceNumber = [VA evt_PMGSequenceNumber]+1
0086 F5704714.Insert
VA evt_InvoiceNumber -> TK JDE Invoice Number
VA evt_PMGNotes -> TK Note Field
0087 VA evt_StartPosition = [VA evt_positionFound]+1
0088 Finds a char position in a string
VA evt_PMGLongField -> szString
VA evt_CarrigeReturn -> cCharToFind
VA evt_StartPosition -> mnStartingPosition
VA evt_positionFound <- mnPositionFound
0089 End While

If you just want a specific length then you can set va evt_characterstoread to that value.

I hope this helps

aaron
 

DSauve

Legendary Poster
I am trying to take the contents of our Item Notes text attachments and include them in a grid. To do this, I will need to be able to read the text into a text variable, and then parse out individual lines, each of which will become a new row in the grid.

I've been looking at your code example, and have a few questions. What data dictionary type do you use for the VA evt_PMGLongField variable? Also, are the functions called at lines 80, 81 and 88 custom-written functions, or are these some JDE functions? I can't seem to find them anywhere.

Finally, does anyone know what the correct way is to parse a text attachment to break it into individual lines?

If there's an easier way to do this, I'm open to suggestions. Thank you.

Don Sauve
Wagstaff, Inc.
OW XE, SP15.1, HP-UX 11.0, Oracle 8.1.6
 
Top