Has anyone attached SDO procedure logic with SDO ?

Posted by jasdeep on 15-Aug-2014 12:07

Can anybody suggest how to use procedure logic with SDO as shown in picture below?

The logic I am trying to implement cannot be implemented staright by SDO, i need to have procedure file attached to it?

How can that be done and how the fields can be added to SDO from the procedure file?

It would be great if somebody explains it with example.

?

All Replies

Posted by Håvard Danielsen on 15-Aug-2014 12:25

The logic procedure will be created and attached to the SDO if you check the check-box and type a valid filename  in the filename field.  Does this not work?  

Why do you think the logic you are trying to implement cannot be implemented straight in the SDO? The only purpose of the logic procedure is to give you the ability to write business logic that also can be reused by other code.  

>> how the fields can be added to SDO from the procedure file?

This question is not clear. A logic procedure does not really have any fields. It works on/with the SDO temp-table.

Posted by jasdeep on 15-Aug-2014 12:38

Thanks Harvard. I have to create and populate a temp table first based on the where condition.

   DEFINE TEMP-TABLE tempRFSH-1

      FIELD Source_Id LIKE RFSH.Source_Id.

FOR EACH RFSH WHERE DATE(RFSH.DATE_Time_Updated) = DATE("03/26/2009")

   BREAK BY RFSH.SOURCE_Id BY DATE(RFSH.DATE_Time_Updated) :

   IF FIRST-OF (RFSH.Source_Id) THEN

   DO:

       CREATE tempRFSH-1.

       ASSIGN tempRFSH-1.Source_Id = RFSH.Source_Id.

   END.

END.

How the logic in the above query can be implemented using SDO?

Then I have to use it in the query block like this. There is requirement of the buffer as well for the same table.

OPEN QUERY qh FOR

   EACH    tempRFSH-1 ,

                 EACH    bufRFSH-2

               WHERE bufRFSH-2.SOURCE_Id = tempRFSH-1.SOURCE_Id

                 AND (bufRFSH-2.QSA_Approved = YES  OR bufRFSH-2.QSA_Approved = NO),

   FIRST   bufRFS NO-LOCK

               WHERE bufRFS .Source_Id = tempRFSH-1.SOURCE_Id ,

   FIRST   tempUA  USE-INDEX I_UID OUTER-JOIN OF bufRFSH-2

               WHERE tempUA .UID = bufRFSH-2.UID  .

So basically following will be used :

RFSH  - its temp table is TempRFSH and its buffer is bufRFSH

bufRFS - it will be buffer for RFS table

tempUA is  temp table for UA.

I was able to implement the self join if I do not use tempRFSH table in second query and use the original table RFSH instead. But this ends up in duplicate records . So to eliminate this I have to use the  first query for creating temp table and populating it.

How the logic in the first query can be implemented using SDO?

Thanks

Posted by Håvard Danielsen on 15-Aug-2014 12:40

The Logic Procedure is documented in the Dynamics documentation in the "Progress Dynamics SmartDataObject" section.

documentation.progress.com/.../dybas.pdf

Note that almost everything covered in this documentation is valid also for a regular SmartDataObject. The "Standard validation procedures for SDOs" section explains how to hook logic into an SDO without a Logic Procedure.  

Posted by Dileep Dasa on 15-Aug-2014 12:44

[mention:04e95b8bf7ad413db8577e7108735503:e9ed411860ed4f2ba0265705b8793d05], please use syntax highlighter when you post some code so that it is more readable. Instructions here:

community.progress.com/.../8723.aspx

Posted by Håvard Danielsen on 15-Aug-2014 13:25

You do not need to use a logic procedure to add a temp-table.  

You define a temp-table in the SDO in the same dialog that you added the buffer.  

This is also documented in the Dynamics documentation. See "Building SmartDataObjects against temp-tables" in the "Building Advanced Business Logic" section.  

--

The difficult part is to figure out where and how to populate the temp-table. This may vary depending on the  requirements as well as the environment. The documentation shows this in the main block, which only makes sense with very static data.

I do not remember much about the SDO temp-table support, but I would probably try to override the openQuery function and add the code to create the temp-table record before the call to super. You should also make sure you empty the temp-table before you populate it.

When you override an SDO procedure or function you should pay attention to the DB-Required flag, which is settable in the Add Function/Procedure wizards and the drop down menu in the Outline View in PDS and as a check-box in the section editor in the standalone AppBuilder.        

In this case you want this to be checked to make sure this logic is only executed on the server side. Do this even if you do not run on an Appserver just in case there is "client side" logic that calls openQuery to open the client Rowobject query.

Posted by jasdeep on 15-Aug-2014 13:53

Thanks Harvard. I read the link that you mentioned in your recent post and try to replicate it. BUt on page 11-6 , it tells about the populating the temp table using the procedure and saving the file. And that procedure is written in main block.

How can we save it  separately , it will be saved as part of the smart window.

Also it says about registering the procedure with Repository . As such there is no repository option in File menu.

Could you please help with this?

Posted by Håvard Danielsen on 15-Aug-2014 14:02

The procedure in the main block in the example is an example of what the reader should add manually.  It is not added automatically.  

Any reference to Repository is Dynamics specific. Just ignore it. It is irrelevant for this case.  

This thread is closed