Not sure if this is the right forum for RoundTable API questions but I prefer a forum over a support call in this case.
I know how to get the current workspace & current object using the api. But I need to determine the product that contains this object.
This is what I have so far, I convert the result into a json object because I find this easier to query and display.
DEFINE VARIABLE McolValues AS CHARACTER NO-UNDO. DEFINE VARIABLE MhSdoObj AS HANDLE NO-UNDO. DEFINE VARIABLE MDataColumns AS CHARACTER NO-UNDO. DEFINE VARIABLE Mwspace-id AS CHARACTER NO-UNDO. DEFINE VARIABLE i AS INTEGER NO-UNDO. DEFINE VARIABLE rtb_object_json AS Progress.Json.ObjectModel.JsonObject NO-UNDO. DEFINE VARIABLE myLongchar AS LONGCHAR NO-UNDO. PUBLISH "evRtbGetCurrentWorkspace":U (OUTPUT Mwspace-id). PUBLISH "evRtbGetObjSdoHandle":U (OUTPUT MhSdoObj). IF VALID-HANDLE(MhSdoObj) THEN DO: MDataColumns = DYNAMIC-FUNCTION('getDataColumns':U IN MhSdoObj). McolValues = DYNAMIC-FUNCTION('colValues':U IN MhSdoObj,MDataColumns). rtb_object_json = NEW Progress.Json.ObjectModel.JsonObject( ). rtb_object_json:Add("Rowids", ENTRY(1,McolValues,CHR(1))). do i = 1 to num-entries(MDataColumns): rtb_object_json:Add(entry(i, MDataColumns), ENTRY(i + 1,McolValues,CHR(1))). end. rtb_object_json:Write(myLongchar, true). MESSAGE string(myLongchar) VIEW-AS ALERT-BOX INFO BUTTONS OK. END. DEFINE VARIABLE phTT AS HANDLE NO-UNDO. DEFINE VARIABLE lLong AS LONGCHAR NO-UNDO. run rtb_get_product_module_groups in MhSdoObj (Mwspace-id, rtb_object_json:GetLongChar("pmod"), rtb_object_json:GetLongChar("obj-group") ,OUTPUT TABLE-HANDLE phTT). phTT:write-json("longchar", lLOng). MESSAGE string(rtb_object_json:GetLongChar("pmod")) skip string(lLong) VIEW-AS ALERT-BOX INFO BUTTONS OK.
I was hoping rtb_get_product_module_groups would contain the product but it just seems to return a record with the input I gave it.
I'm trying to get all the info I need to fill-out the Repository browser screen automatically.
Hi Carl.
The procedure ‘rtb_get_product_module_groups’ returns a temp-table of Object Groups for the given Workspace and Product Module. That is probably not what you are looking for and is really not a “public” API so I would not recommend calling it.
However, you can ask the proxy layer for it:
DEFINE VARIABLE hTT AS HANDLE NO-UNDO. DEFINE VARIABLE hBuf AS HANDLE NO-UNDO. RUN rtb/PROXY/p/rtbGetPmod.p ( “MyPmod”, OUTPUT TABLE-HANDLE hTT). hBuf = hTT:DEFAULT-BUFFER-HANDLE. hBuf:FIND-FIRST(). MESSAGE hBuf::product-id. FINALLY: DELETE OBJECT hTT. END FINALLY.
I created following function that seems to work but I'm not sure it's the correct way to do it.
{rtb/i/rtb_super.i} function getPmodProduct returns character (input iPmod as character): DEFINE VARIABLE hPmod AS HANDLE NO-UNDO. DEFINE VARIABLE mColValues AS CHARACTER NO-UNDO. hPmod = fnRtbStartSuperSdo("rtb_u_pmod.w", this-procedure, no). DYNAMIC-FUNCTION('setQueryWhere' in hPmod, substitute("rtb.rtb_pmod.pmod = '&1'", iPmod) ). dynamic-function('openQuery' in hPmod). McolValues = DYNAMIC-FUNCTION('colValues':U IN hPmod, "product-id"). RUN destroyObject IN hPmod NO-ERROR. return entry(2, McolValues, chr(1)). end.
Hi Carl.
The procedure ‘rtb_get_product_module_groups’ returns a temp-table of Object Groups for the given Workspace and Product Module. That is probably not what you are looking for and is really not a “public” API so I would not recommend calling it.
However, you can ask the proxy layer for it:
DEFINE VARIABLE hTT AS HANDLE NO-UNDO. DEFINE VARIABLE hBuf AS HANDLE NO-UNDO. RUN rtb/PROXY/p/rtbGetPmod.p ( “MyPmod”, OUTPUT TABLE-HANDLE hTT). hBuf = hTT:DEFAULT-BUFFER-HANDLE. hBuf:FIND-FIRST(). MESSAGE hBuf::product-id. FINALLY: DELETE OBJECT hTT. END FINALLY.