Media Object API JDEGTAllocFetchText() not working for me

Ali Saeed

Ali Saeed

Member
I'm trying to fetch text in the attachments using JDEGTAllocFetchText(), but it doesn't fetch the text. The function prototype is:

JDERTN(LPSTR) JDEWINAPI JDEGTAllocFetchText(
LPSTR pObjectName,
LPVOID pKey,
BOOL bConvert );

<font color="green"> /*****************************
* My Code
*****************************/</font>

DSGT00092 dsGT00092Key;
LPSTR lpText = (LPSTR)NULL;

ParseNumericString(&dsGT00092Key.mnSuppDataNumericKey1, "211817");

lpText = JDEGTAllocFetchText ( "GT00092", &dsGT00092Key, TRUE);


/* The debugger shows the lpText as <font color="red"> CXX0030: Error: Expression cannot be evaluated </font>
<font color="green">
I ran JDEGTExists() which returns JDEDB_PASSED to confirm the attachment does exist */

</font>


Thanks for your help in advance.
 
Ali,

Not sure what release you're on, I guess pre 8.10.

Try using the API GetAllGenericTextName. It has the same parameter list.

And don't forget to JDEGTTextFree

Craig
 
Thanks for the reply Mr. Craig. I was actually trying to access more than one text attachment. GetGenericTextName only returns the text of the first attachment.

btw I'm on Xe B7333
 
Perhaps you could turn on tracing to produce the jdedebug.log.

From your example:

1. The key structure is not being memset to clear it.
memset(memset(&dsGT00092Key, 0x00, sizeof(DSGT00092));
If it is not cleared, the data structure can contain random values.

2. Only one member of the GT data structure is being populated.
ParseNumericString(&dsGT00092Key.mnSuppDataNumericKey1,"211817");

The API will select F00165 records with the following key:
F00165 WHERE ( GDOBNM = 'GT00092' AND GDTXKY = '||||211817|0||' AND GDGTMOTYPE = 0 )

It will not select all F00165 records with 211817 in the key. The API builds a pipe delimited key from the data structure.

The debug log will show what SQL the API is generating.

Craig
 
Back
Top