S
sanreddy
Guest
Hi Meyrick, You can add extra read methods in your business entity and annotate them with invoke annotations. Below is the sample Business entity code which has two read methods. One read method ( ReadTempTable ) is annotated with read annotations and another read method ( CustomReadTempTable ) with invoke annotations. @openapi.openedge.export(type="REST", useReturnValue="true", writeDataSetBeforeImage="false"). @progress.service.resourceMapping(type="REST", operation="read", URI="?filter=~{filter~}", alias="", mediaType ="application/json"). METHOD PUBLIC VOID ReadTempTable( INPUT filter AS CHARACTER, OUTPUT TABLE ttItem ): DEFINE VARIABLE cWhere AS CHAR NO-UNDO. EMPTY TEMP-TABLE ttItem. BUFFER ttItem:ATTACH-DATA-SOURCE(DATA-SOURCE data-srcTempTable:HANDLE). cWhere = TRIM(filter). IF cWhere NE "" AND cWhere NE ? THEN DO: DATA-SOURCE data-srcTempTable:FILL-WHERE-STRING = cWhere. END. DATASET dsItem:FILL(). BUFFER ttItem
ETACH-DATA-SOURCE(). END METHOD. @openapi.openedge.export(type="REST", useReturnValue="true", writeDataSetBeforeImage="false"). @progress.service.resourceMapping(type="REST", operation="invoke", URI="/CustomReadTempTable", alias="", mediaType ="application/json"). METHOD PUBLIC VOID CustomReadTempTable( INPUT filter AS CHARACTER, INPUT qryPos AS INTEGER, OUTPUT TABLE ttItem ): DEFINE VARIABLE cWhere AS CHAR NO-UNDO. MESSAGE 'In CustomReadTempTable, filter = ' filter. MESSAGE 'In CustomReadTempTable, qryPos = ' qryPos. EMPTY TEMP-TABLE ttItem. BUFFER ttItem:ATTACH-DATA-SOURCE(DATA-SOURCE data-srcTempTable:HANDLE). cWhere = TRIM(filter). IF cWhere NE "" AND cWhere NE ? THEN DO: IF NOT cWhere BEGINS "Where" THEN cWhere = SUBSTITUTE('Where Item.ItemNum = &1', cWhere). DATA-SOURCE data-srcTempTable:FILL-WHERE-STRING = cWhere. END. DATASET dsItem:FILL(). BUFFER ttItem
ETACH-DATA-SOURCE(). END METHOD. Hope this helps, Sanjeev. From: meyrick [mailto:bounce-meyrick@community.progress.com] Sent: 28 March 2014 PM 12:31 To: TU.Mobile@community.progress.com Subject: RE: Methods in Business Entity RE: Methods in Business Entity Reply by meyrick thanks for all the help. Ricardo, I have also been using the pipe delimiter. Its seems to be the most simplest way. I do not know how to implement invoke methods. All i was wanting to do is add extra read methods to my business entity. Stop receiving emails on this subject. Flag this post as spam/abuse.
Continue reading...


Continue reading...