Print Multiple Media Objects (attachments)

Ghost Sailor

Member
I'm looking for a way to print (via a UBE) the fully qualified path & file name ( \\server1\folderX\file1.doc \\server2\folderY\spreadsheet2.xls etc ) for all media objects (aka attachments) associated with an AR invoice.

Some being files on the server shared folders, and some being multiple text attachments (stored in EnterpriseOne [OneWorld]), and some being embedded images, and other files, etc.

Ideally, I'd like to have a custom UBE where we batch print the invoice and then all of the attachments directly behind it.

But I would settle for just printing the fully qualified path and file name listing...

I've seen literally over 100 posts going back over a year, but no definative answers. Some excerpts, synopsis, summary info for everyone to consider or respond to:

1) It appears that a single text attachment is simply retrieved using a system function for media objects like GT03B11 using 4 keys - company, document, type, line number. Many of us have done things along these lines. No problem here.

2) But additional text attachments are not accessible via system functions - media objects. Unsure here?

3) If you create a single linked file attachment, the fully qualified path and file name appears in the F00165 table GDTXVC column, surrounded by some garbage characters if you use UTB to view it. But if you add additional text attachments, and linked files, you can no longer read the path and file name with UTB. Maybe that F00165 field is now a BLOB pointer?

4) You can NOT fetch single a record that has a BLOB column in it. You need an API in C++ to do this. Potential source code from another post by jdeprofessional:
the api to do that is JDB_FetchKeyed. and you have to use the following
jdeNIDcpy(dbRef.szDict, NID_TXVC); //NID_DESC2000
lpCol = JDB_GetTableColInfo ( hRequestF55IN03B, dbRef );
MOBlob.moTextSize = strlen((const char *)(lpCol->lpJDEValue)) + 2;
pGenText = (char *) jdeAlloc(COMMON_POOL, MOBlob.moTextSize, MEM_ZEROINIT);
memcpy (pGenText, lpCol->lpJDEValue, MOBlob.moTextSize);
*(pGenText + MOBlob.moTextSize - 2) = 0x00;
you must the gentext to copy attachment if it was text or path.

Unsure here? Seems like this may be a key to the BLOB answer, but only a small part of the solution.

5) Embedded file attachments are stored in server directories specified by the media object queues' configuration. For these embedded files, a JDE encryption process takes place so they are not accessible by external programs. But they are accessible by JDE, just not in the developers toolset? Maybe this is in underlying C++ code within some business function(s). Maybe this is where we need the BLOB C++ code funtionality. Unsure here?

Does anyone have some good firm experience on this?

Hopefully gathering, sorting out, and presenting this all together will help us with a solution to printing all media objects associated with a transaction or record in JDE.

Thanks in advance, and I look forward to organizing the responses here in the forum.
 
I did manage to dig out and find a burried copy of the ERP 8 Standalone - and here's what I suggest, so far.

The below solution is taken using the F00165 as the Input table (I just wanted to quickly see how it was done).

Both the URL and the location of the file start on the 29th character internal to the media object. The location appears to be surrounded by the hat symbol on both sides.

Use the function "B7500150 - Find a Character Position In A String to locate the end of the url/location...

A working ER - looks like this:

0001 VA rpt_URL = substr([BC Media Object - Vaiable Length Column (F00165)],29,200 )
0002 Finds a char position in a string
VA rpt_URL -> szString
"^" -> cCharToFind
"<Zero>" -> mnStartingPosition
VA evt_EndLocation <- mnPositionFound
0003 VA rpt_LocationText = substr([BC Media Object - Vaiable Length Column (F00165)],29,[VA evt_EndLocation])
0004 RV ReportLocation = VA rpt_LocationText

So far, it works. At least it provides the response I was expect (just the url or just the file location)

I'll review how to get the same results using getmedia object, after Zachary goes to sleep (he's far too active right now).

db
 
Zyachary finally went to sleep, last night...

I've devised a script that will pull the the URL or UNC - if it is the only media object attachment. I have created logic for finding the the next(s) - but I have one little issue in completion.

In my previous example I use the function "Finds a char position in a string". What I really need is a function that "Finds a STRING position in a string".

I'm not much of a C guy - so I am sort of stuck, and need a bit of a nudge. The function "Finds a char position in a string" use the logic of 'Position = STRSTR (String, Character)' to return the position. Can the STRSTR syntax be used to return the position of a string within a string? If so, I think I've mostly got it down (just need to copy the "Finds a char position in a string" function and tweak.

OR is there a function that I have overlooked - that already ruturns the string location of a string within a string (I couldn't find one)...

It's sort of fun to do this - thanks ghost!

db
 
Maybe you could do this. Once you find the first URL/UNC, cut that part off the string, and only work with the rest. Then find the next, etc.
 
I've got a working template - I'm trying to complete it...

Basically I created a function that returns the location of a string within a string. Then substring out from that starting location and find the location of the first '^' symbol (using the same function) - that provides me the URL.

It's not pretty, yet - but it is 'mostly' functional.

There will need to be some fairly strict policies, regarding how urls/uncs are maintained - for this to work properly (capitalization, always prefixing with http: or www or :\ or ....)

I'll provide the code when it's more functional and prettier.

db

zach's teething - there is no peace. there is no quiet. there is no rest.
 
Basically:
H Spec:
/*****************************************
* TYPEDEF for Data Structure
* Template Name: Find the Location of a String in a String
* Template ID: D550001
* Generated: Thu Feb 26 21:46:27 2004
*
* DO NOT EDIT THE FOLLOWING TYPEDEF
* To make modifications, use the OneWorld Data Structure
* Tool to Generate a revised version, and paste from
* the clipboard.
*
**************************************/

#ifndef DATASTRUCTURE_D550001
#define DATASTRUCTURE_D550001

typedef struct tagDSD550001
{
char szString[1001];
char szStringToFind[21];
int nPositionFound;
} DSD550001, *LPDSD550001;

#define IDERRszString_2 2L
#define IDERRszStringToFind_3 3L
#define IDERRnPositionFound_6 6L

#endif






C Function:
/* Set defaults */
jdeStripTrailingBlanks(lpDS->szString);
jdeStripTrailingBlanks(lpDS->szStringToFind);

pdest = strstr( lpDS->szString, lpDS->szStringToFind );
if (pdest != NULL)
{
lpDS->nPositionFound = pdest - lpDS->szString;
}
else
{
lpDS->nPositionFound = 999;
}


Event Rules (with walker and stripper):
Listing of ER for Report: Media Object URL in a (R55MEDOBJ)


=======================================================================
SECTION: Sales Order Detail - Revisions [GROUP SECTION] (S4)
=======================================================================
OBJECT: SECTION
EVENT: Do Section
-----------------------------------------------------------------------
evt_GenericLong
evt_NameObject
evt_LanguagePreference
evt_MediaObjectVariableLengthC
evt_PostionWhereFound
evt_PositionWhereEnd
evt_EndLoop
evt_BuildMediaObject
0001 ! Media Objects(GT4211A, <Get Text>, RV URL or Location, BC Document (Order No, Invoice, etc.) (F4211), BC Order Type (F4211), BC Order Company (Order Number) (F4211), BC Line Number (F4211))
0002 RV Generic Text Key = concat( [BC Document (Order No, Invoice, etc.) (F4211)],"|")
0003 RV Generic Text Key = concat([RV Generic Text Key],[BC Order Type (F4211)])
0004 RV Generic Text Key = concat([RV Generic Text Key],"|")
0005 RV Generic Text Key = concat([RV Generic Text Key],[BC Order Company (Order Number) (F4211)])
0006 RV Generic Text Key = concat([RV Generic Text Key],"|")
0007 //
0008 RV Generic Text Key = concat([RV Generic Text Key],[BC Line Number (F4211)])
0009 VA evt_NameObject = "GT4211A"
0010 VA evt_LanguagePreference = " "
0011 F00165.Fetch Single
VA evt_NameObject = TK Object Name
RV Generic Text Key = TK Generic Text Key
VA evt_LanguagePreference = TK Language
VA evt_MediaObjectVariableLengthC <- TK Media Object - Vaiable Length Column
0012 //
0013 //
0014 VA evt_PostionWhereFound = 1
0015 VA evt_EndLoop = 998
0016 RV Ori Generic Text Key = VA evt_MediaObjectVariableLengthC
0017 While VA evt_PostionWhereFound is less than VA evt_EndLoop
0018 Find the Postition of a String in a String
VA evt_MediaObjectVariableLengthC -> szString
"www" -> szStringToFind
VA evt_PostionWhereFound <- nPositionFound
0019 VA evt_MediaObjectVariableLengthC = substr([VA evt_MediaObjectVariableLengthC],[VA evt_PostionWhereFound],1000)
0020 Find the Postition of a String in a String
VA evt_MediaObjectVariableLengthC -> szString
"^" -> szStringToFind
VA evt_PositionWhereEnd <- nPositionFound
0021 VA evt_BuildMediaObject = substr([VA evt_MediaObjectVariableLengthC],0,([VA evt_PositionWhereEnd]-3))
0022 VA evt_BuildMediaObject = rtrim(ltrim([VA evt_BuildMediaObject],'^'),'^')
0023 RV URL or Location = concat([RV URL or Location]," | ")
0024 RV URL or Location = concat([RV URL or Location],[VA evt_BuildMediaObject])
0025 VA evt_MediaObjectVariableLengthC = substr([VA evt_MediaObjectVariableLengthC],[VA evt_PositionWhereEnd],1000)
0026 End While
0027 //
0028 //
0029 //
0030 //


Yes - it is infantile, but - if you plug in 'www' for the first find string in string and '^' for the second - it comes out OK

db
 
Just wanted to chime in with a few commercial solutions we offer in this area: AUTOPRINT to make jobs automatically Print Immediate, EverPrint to print the output on any printers, not limited to PostScript or PCL, including Zebra and EverMOPrint to print JDE MO Attachments (text or files) - from the UBE's or separately, all or some.
 
Back
Top