question

Upvotes
Accepted
97 2 4 10

REDI API cancel order by OrderRefKey

I have the following code but it throws type mismatch.

object err = null;
rediCache.Submit("Message", "Status==0 || Status==1 || Status==2 || Status==3", ref err);
rediCache.CancelByKey(redi_user_id, "gS01568314", ref err);

System.Runtime.InteropServices.COMException: 'Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))'

Could you also explain whether .submt() is necessary and what those status denotes?

Additionally, is there anything I must do when stopping application? Sometimes I noticed REDI hangs after I abruptly terminate redi api application.

Thank you!

apiredi-apiorder
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
38.1k 71 35 53

@39783854-26aa-4fea-bc93-00b2ec21f8bb

I got the same exception if CancelByKey is called immediately after Submit. It works fine if I call CancelByKey in the CacheEvent handler.

However, from my test, the CancelByKey can be called without Submit.

object err = null;

rediCache.CancelByKey(redi_user_id, "gS01568314", ref err);

The meanings of status codes and where options are mentioned in Appendix A REDI Data Fields in the REDI API SPECIFICATION.

 '======= REDI ORDER STATUS TABLE (status) =============
 ' 0: Open  1: Partial  2: Complete 3: Canceled 4: Reject
 ' 5: Deleted  6: Failed  7: Pending Reroute 8: Pending
 '======================================================

For the hang issue, we need more information. Could you please share the application and steps to replicate the problem?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
97 2 4 10

it worked with just submit as you had stated.

I got the example from REDI API pdf

1.10 Order Cancellation

Cancelling an Order By ‘OrderRefKey
Public WithEvents OrderQuery As CacheControl

Sub CancelOrder() Set OrderQuery = New CacheControl
Dim verr, table, where
table = “Message”
where = “Status==0 || Status==1 || Status==2 || Status==3”
OrderQuery.Submit table, where, verr
‘ Cancel Order
OrderQuery.CancelByKey “parkmm”, “YSJ1069332”, verr End Sub
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
97 2 4 10

it worked with just submit as you had stated.

I got the example from REDI API pdf

1.10 Order Cancellation

Cancelling an Order By ‘OrderRefKey
Public WithEvents OrderQuery As CacheControl

Sub CancelOrder() Set OrderQuery = New CacheControl
Dim verr, table, where
table = “Message”
where = “Status==0 || Status==1 || Status==2 || Status==3”
OrderQuery.Submit table, where, verr
‘ Cancel Order
OrderQuery.CancelByKey “parkmm”, “YSJ1069332”, verr End Sub
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
97 2 4 10

it worked with just submit as you had stated.

I got the example from REDI API pdf

1.10 Order Cancellation

Cancelling an Order By ‘OrderRefKey
Public WithEvents OrderQuery As CacheControl

Sub CancelOrder() Set OrderQuery = New CacheControl
Dim verr, table, where
table = “Message”
where = “Status==0 || Status==1 || Status==2 || Status==3”
OrderQuery.Submit table, where, verr
‘ Cancel Order
OrderQuery.CancelByKey “parkmm”, “YSJ1069332”, verr End Sub
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
97 2 4 10
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea