Progress service object error from trigger: bug?

Posted by KorakSchoone on 19-Sep-2016 03:12

In Rollbase 4.3 we have two Objects connected through Progress Openedge services: Orderlines and Items.
Between these two we have an Openedge relationship via the ItemCode field in both tables (this is a character field).
This works like it should.
 
On the orderline object we have an object trigger to calculate the orderline price.
This trigger runs AfterCreate and AfterUpdate.
 
In the trigger we have the follwing line: var itemcode = {!ItemCode};
We use this value to make a call to Corticon to calculate the total price.
This works fine in trigger debugger.
 
But when we do an update or create on the Ordeline we get an error on the codeline stated above.
This error comes from the Progress service and states: "Cannot understand after "WHERE Item.Itemcode =".
 
It looks that by requesting this field value in Rollbase a call to the Openedge service is made, but the value is not filled correctly.
 
Are we missing something or is this a bug?

All Replies

Posted by egarcia on 19-Sep-2016 05:25

Hello,

It looks like Rollbase is passing an unexpected value to the WHERE clause.

It would be important to know the full error message to see why the query to the service fails.

You could look at the log file for the AppServer. If you are using a private installation of Rollbase, then you can look at the Rollbase logs for the requests to an OpenEdge service.

Alternatively, you could add debug messages to the Business Entity to see the value that is sent.

Rollbase can make use of  the JSON Filter Pattern (JFP) if it is enabled in a Business Entity.

Perhaps, the issue is that Rollbase is sending an expression formatted for the JFP but the Business Entity is not expecting it.

Here is a link to the documentation in case this is the case and you need to enable it:

- documentation.progress.com/.../index.html

(This same pattern works with the Kendo UI DataSource.)

I hope this helps.

Posted by KorakSchoone on 19-Sep-2016 06:16

Thank you for the reply.

We are using the JSON Filter pattern and that is working fine.

I will check the log files for the full error.

I recognize the pattern in the error i get (with the errornumber at the end) that it is a OpenEdge error.

The weird thing is that it works fine in the trigger debugger, but that we get this error when the trigger is used from a save of the orderline.

Posted by KorakSchoone on 19-Sep-2016 10:44

This is the complete error line from the logfiles:

127.0.0.1 - - [18/Sep/2016:12:05:51 +0200] "GET /storage/servlet/Log?custId=1&logSessionId=245582704786A699DFD67ACDD6BB8F3D75AC16B38807.Pas_Instance&logClientIP=0%3A0%3A0%3A0%3A0%3A0%3A0%3A1&logText=Field+%22Amount%22+has+been+updated.%3Cbr%3E%0AError+executing+Trigger%3A+%22Trigger+Corticon+Salesprice%22+Error+missing+%3B+before+statement+%28line+%236%29+%5BTrigger%3A+%22Trigger+Corticon+Salesprice%22+Object%3A+%22Salesorderline%22+Salesorderline%3A+103+%2F+0%5D+in+formula%3A%0A%0Avar+DDate+%3D++rbv_api.formatDate%28new+Date%28%22%22%29%2C%22yyyy%2FMM%2Fdd%22%29%3B%0D%0Avar+iAmount+%3D+2.0%3B%0D%0AiAmount+%3D+iAmount.toFixed%280%29%3B%0D%0Avar+ItemCode+%3D+ERROR%3A+ERROR+condition%3A+**+Unable+to+understand+after+--+%22WHERE+ItemCode%3D%22.+%28247%29+%287211%29%3B%0D%0A%2F%2Fvar+ItemCode+%3D+ERROR%3A+ERROR+condition%3A+**+Unable+to+understand+after+--+%22WHERE+ItemCode%3D%22.+... HTTP/1.1" 200 - 0

Not very readable.

Posted by egarcia on 19-Sep-2016 13:35

There might be a better message in the AppServer agent log file.

Please check.

Thanks.

Posted by KorakSchoone on 20-Sep-2016 03:58

On the PAS OE server where the Progress Services run we have this message:

[16/09/19@08:38:42.132+0200] P-004036 T-003372 1 AS-12 -- ** Unable to understand after -- "WHERE ItemCode=". (247)

[16/09/19@08:38:42.132+0200] P-004036 T-003372 1 AS-12 -- PREPARE syntax is: {FOR | PRESELECT} EACH  OF.. WHERE ... etc". (7324)
[16/09/19@08:38:42.132+0200] P-004036 T-003372 1 AS-12 -- Failed to auto-prepare an automatic fill query. (11981)
[16/09/19@08:38:42.132+0200] P-004036 T-003372 1 AS-12 -- FILL of buffer ttArticle with user-supplied query requires that the query be QUERY-PREPARED. (11876)
It is clear here that the filter string provided to the service is not filled correctly.
Posted by egarcia on 20-Sep-2016 04:50

Hello,

It certainly looks like Rollbase is passing an unexpected value to the WHERE clause.

I was able to get the same error if i pass an incomplete ablFilter expression to the backend:

oemobiledemo.progress.com/.../Customer

If the expression is complete then there are no issues:

oemobiledemo.progress.com/.../Customer

In my constructed example, i omitted the value next to CustNum=

We might still want to confirm on the expression that Rollbase is sending.

Perhaps via messages in the Business Entity.

I am guessing that {!ItemCode} is not set at the tine the code is run.

Perhaps a developer in the Rollbase team can clarify on when it is expected to be set for a trigger.

Alternatively you could log an issue with Technical Support.

I hope this helps.

Posted by KorakSchoone on 20-Sep-2016 05:07

Thanks for your help!

Messages in the Business Entity give the same indication, namely that the filter is not filled correctly.

Help from a Rollbase developer would be very much appreciated.

Posted by Mohammed Siraj on 20-Sep-2016 09:01

Can you please alter the initialization statement in trigger as follows:

var itemcode = '{!ItemCode}' || '0'; //added quotes around token

Above, if {!ItemCode} token is evaluted as string literal, initialization will fail without quotes.

Posted by KorakSchoone on 22-Sep-2016 00:55

Hello Siraj,

Thank you!

That seems to have solved the problem.

Will test it some further to be sure.

Posted by KorakSchoone on 24-Sep-2016 02:27

After some further testing this did not solve the problem.

I still get the same error when I update a salesorder line.

This thread is closed