I'm studying PDSOE in 11.6 and I still didn't figure out how to implement validations on server side, got this few questions that could help me developing my sample project:
1) Where do I place the validations? Inside the class.method I'm working?
For exemple: Got a class with this method of Update.
2) Do I place it before or after the SUPER? (Is there anyplace where I can check the code of the businessEntity?)
3) How can I return the error? is it with the AppError? for example:
if table.name = '' then do: ASSIGN clsError = NEW AppError("name must be filled"). RETURN ERROR clsError. end.
4) And how do i cath/show this error in kendo grid?
1) Where do I place the validations? Inside the class.method I'm working?
2) Do I place it before or after the SUPER?
(Is there anyplace where I can check the code of the businessEntity?)
3) How can I return the error? is it with the AppError? for example:
4) And how do i cath/show this error in kendo grid?
Thank for the feedback again Peter, you are being very helpful.
Again, for me this is something totaly new and unfortunatelly I still didn't get the validation, for example got this class, where I put ERROR and REJECT.
METHOD PUBLIC VOID ReadItem( INPUT filter AS CHARACTER, OUTPUT DATASET dsItem): SUPER:ReadData(filter). ASSIGN BUFFER ttItem:ERROR = TRUE BUFFER ttItem:REJECTED = TRUE BUFFER ttItem:ERROR-STRING = "code error string". END METHOD.
But when I check the service, it stills returning me the same Json:
{ "dsItem": { "ttItem": [{ "Itemnum": 1, "ItemName": "Fins", "Price": 24.0, "Onhand": 13022, "Allocated": 9399, "ReOrder": 1, "OnOrder": 433, "CatPage": 1, "CatDescription": "These real shark-skin fins will knock 'em dead at the beach. They'll see you coming from miles away while you're wearing the Original \"Fins\" by Bench\/Lee. ", "Category1": "Diving", "Category2": "Footwear", "Special": "1", "Weight": 4.0, "Minqty": 5 }] } }
Shouldn't it return to me some kind of error in the json? How can I add this properties that you mentioned (msg/field/tbl/id) to my response?
EDIT:
My bad, now that I restarted the oepas it's showing to me an abl error, I'll modified and see if there is something new.
{"_errors":[{"_errorMsg":"Erro de 4GL: O registro ttItem nao esta disponivel para configurar ERROR. (11916) (7211)","_errorNum":11916}]}