- Use Failure rules - the user guide is a bit vague. Are there examples in any of the Sample apps? Or does anyone have a test BSV demonstrating how it works?
- Have imports fail gracefully - for example if there is a typo in the field headings of a CSV file that is being imported the process collapses in a heap. I'd like to be able to trap the failure and progress to return to later. Also it would be helpful for operator use to not have to debug and rerun everything.
- Capture the ImportResults from an import process as per p375 of the user guideI have used this to try to populate an import log BO with attibutes ErrorsDetected (which returns "yes" or "No" (literal not binary) but the Log attribute never has any data in it.
Code: Select all
After the import has been finished a special predefined object called ImportResults is placed into the Context. You can use this object to obtain import log and check whether any errors have been detected. This object has the following attributes – ErrorsDetected and Log.
- Last question, what is the escape character to allow the use of single quotes in my CSV. I have a list of dial codes that is imported and for some reason the cross reference to country CIV - Cote d'Ivoire never finds the appropriate country and with Create if not found it generates a new Country for Cote d'Ivoire even though there is already a record for that. (I have to cross reference against Country and not just ISO3 code because Ceuta and Melilla are ESP but are geographically different
Importing and Error Management?
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Importing and Error Management?
Does anyone have any examples of how to:
Re: Importing and Error Management?
1) Attached is a bsv that demonstrates failure rules, see below for more details
2) Sorry can not help you
3) I have stopped trying to get that to work, let me know if you have any success.
4) I am not 100% sure this is correct, but try \047
FailureRules.bsv details
This BSV has 2 BOs: UpdatedBO and UpdateData
UpdatedBO has the following attributes: Name, Description, Total and LastUpdate.
It also has 2 rules:
A) if the BO was changed, update the LastUpdate to CURRENT_TIMESTAMP
B) if Total > 10000, REPORT ERROR 'Total Too High'
UpdateData has the following attributes: Name, Number1, Number2, Description and ErrorMessage.
This BO has no rules.
UpdatData has data to be used to update UpdatedBO.
This BSV has several processes
CreateDate => deletes any existing test data and creates new test data
FindUpdateData1 => finds all UpdateData in batches of 1 and calls WithFailureRules
WithFailureRules => basically, it finds the UpdatedBO with the same name as UpdatdData and sets UpdatedBO.Total = Updatedata.Number1 * Updatedata.Number2. If there is no UpdatedBO with the smae name as the UpdateDate, REPORT ERROR 'record not found' is executed.
This process has failure rules that save the error message in the UpdateData.ErrorMessage field and if the error message was 'Total Too High' the UpdatedBO.Total is set to -1.
FindUpdateData2 => just like FindUpdateData2 except executes NoFailureRules after the find.
NoFailureRules => just like WithFailureRules but (surprise) it does not have any failure rules.
To use this BSV:
load it into your Aware system and sign in as admin.
select the menu item "Create Test Data" to create the test data
select the menu item "Run No Failure Rules" to executd FindUpdateData2 and NoFailureRules. The first UpdatedBO will be updated successfully, but you will get an error "Total Too High" for the second UpdateBO and it will not be updated. Also the process will be terminated and the third UpdateData record will not be processed.
select the menu item "Run With Failure Rules" to execute FindUpdateData1 and WithFailureRules. No errors will be displayed, both UpdateBO records will be updated and the last 2 UpdateData records will have the errors saved in the Error Message field.
I do not use failure rules on processes run by users, since I want the user to see the error and let them choose what action to take. But I have multiple processes that run via the scheduler and they all have failure rules so that they run to completion even if there are errors.
2) Sorry can not help you
3) I have stopped trying to get that to work, let me know if you have any success.
4) I am not 100% sure this is correct, but try \047
FailureRules.bsv details
This BSV has 2 BOs: UpdatedBO and UpdateData
UpdatedBO has the following attributes: Name, Description, Total and LastUpdate.
It also has 2 rules:
A) if the BO was changed, update the LastUpdate to CURRENT_TIMESTAMP
B) if Total > 10000, REPORT ERROR 'Total Too High'
UpdateData has the following attributes: Name, Number1, Number2, Description and ErrorMessage.
This BO has no rules.
UpdatData has data to be used to update UpdatedBO.
This BSV has several processes
CreateDate => deletes any existing test data and creates new test data
FindUpdateData1 => finds all UpdateData in batches of 1 and calls WithFailureRules
WithFailureRules => basically, it finds the UpdatedBO with the same name as UpdatdData and sets UpdatedBO.Total = Updatedata.Number1 * Updatedata.Number2. If there is no UpdatedBO with the smae name as the UpdateDate, REPORT ERROR 'record not found' is executed.
This process has failure rules that save the error message in the UpdateData.ErrorMessage field and if the error message was 'Total Too High' the UpdatedBO.Total is set to -1.
FindUpdateData2 => just like FindUpdateData2 except executes NoFailureRules after the find.
NoFailureRules => just like WithFailureRules but (surprise) it does not have any failure rules.
To use this BSV:
load it into your Aware system and sign in as admin.
select the menu item "Create Test Data" to create the test data
select the menu item "Run No Failure Rules" to executd FindUpdateData2 and NoFailureRules. The first UpdatedBO will be updated successfully, but you will get an error "Total Too High" for the second UpdateBO and it will not be updated. Also the process will be terminated and the third UpdateData record will not be processed.
select the menu item "Run With Failure Rules" to execute FindUpdateData1 and WithFailureRules. No errors will be displayed, both UpdateBO records will be updated and the last 2 UpdateData records will have the errors saved in the Error Message field.
I do not use failure rules on processes run by users, since I want the user to see the error and let them choose what action to take. But I have multiple processes that run via the scheduler and they all have failure rules so that they run to completion even if there are errors.
- Attachments
-
- FailureRules.bsv.zip
- (41.42 KiB) Downloaded 532 times
Bob
Save the ImportResults document after IMPORT Action
--> Importing a file and saving the ImportResults log file.
Been working for me since v7
BO Process
DB Recs
--> JaymerTip
Been working for me since v7
BO Process
DB Recs
--> JaymerTip
Last edited by Jaymer on Thu Oct 24, 2019 7:01 pm, edited 3 times in total.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Importing and Error Management?
Jaymer wrote:Been working for me since v7
BO Process
DB Recs
Thanks Jaymer. Looking at your example I notice that the Log is a Document object. This seems to be a KEY piece of information that is missing from the documentation.
This is a running sore with me, I am fed up being made to feel like a moron for not being able to get something to work because key pieces of information are omitted from the manuals. The exact text from the manual is
Code: Select all
After the import has been finished a special predefined object called ImportResults is placed into the Context. You can use this object to obtain import log and check whether any errors have been detected. This object has the following attributes – ErrorsDetected and Log.
I would HAPPILY forgo an entire upgrade cycle in preference to seeing the documentation fixed, brought fully up to date and available online in a way that the community can comment and add to as a knowledge resource. Otherwise key functionality just looks like it doesn't work, which undermines the work that Vlad et al has done on a pretty cool piece of software.
Re: Importing and Error Management?
Then I must self congratulate myself as a genius for figuring it out.
Truth is, there’s no way I could remember how I figure that out. Or if I found an example, or emailed Vladimir. No idea - it was so long ago.
But this is similar to the hours I spent trying to get email working where are each user can have his own email account login and password information.
George just helped on another thread, with the sample bsv that didn’t what is needed.
English is not his native tongue, so I’m going to rewrite it, because it’s extremely handy for everyone to know, and by no means is it documented and obvious.
Again, similarly, Bwalk contacted me recently about executing a curl command.
He was pointing out that he is mostly a python developer. And in python it’s very easy to find library‘s, import them, and just get something to work.
Whereas in his new journey in aware, he’s having to spend time, invent, pay money I think in some cases, to get certain tasks to run.
There is no documentation on how to send an SMS message. Something, that in today’s age, you would think should be a standard part of the software and it’s documentation.
Truth is, there’s no way I could remember how I figure that out. Or if I found an example, or emailed Vladimir. No idea - it was so long ago.
But this is similar to the hours I spent trying to get email working where are each user can have his own email account login and password information.
George just helped on another thread, with the sample bsv that didn’t what is needed.
English is not his native tongue, so I’m going to rewrite it, because it’s extremely handy for everyone to know, and by no means is it documented and obvious.
Again, similarly, Bwalk contacted me recently about executing a curl command.
He was pointing out that he is mostly a python developer. And in python it’s very easy to find library‘s, import them, and just get something to work.
Whereas in his new journey in aware, he’s having to spend time, invent, pay money I think in some cases, to get certain tasks to run.
There is no documentation on how to send an SMS message. Something, that in today’s age, you would think should be a standard part of the software and it’s documentation.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Importing and Error Management?
Lucky you. Does not work if using FROM XMLJaymer wrote:Been working for me since v7
BO Process
DB Recs
Bob
-
- Posts: 1460
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Importing and Error Management?
Thanks BobK, I had a look at this and that seems straight forward.BobK wrote:1) Attached is a bsv that demonstrates failure rules, see below for more details
....
FailureRules.bsv details
This BSV has 2 BOs: UpdatedBO and UpdateData
UpdatedBO has the following attributes: Name, Description, Total and LastUpdate.
It also has 2 rules:
A) if the BO was changed, update the LastUpdate to CURRENT_TIMESTAMP
B) if Total > 10000, REPORT ERROR 'Total Too High'
UpdateData has the following attributes: Name, Number1, Number2, Description and ErrorMessage.
This BO has no rules.
UpdatData has data to be used to update UpdatedBO.
This BSV has several processes
CreateDate => deletes any existing test data and creates new test data
FindUpdateData1 => finds all UpdateData in batches of 1 and calls WithFailureRules
WithFailureRules => basically, it finds the UpdatedBO with the same name as UpdatdData and sets UpdatedBO.Total = Updatedata.Number1 * Updatedata.Number2. If there is no UpdatedBO with the smae name as the UpdateDate, REPORT ERROR 'record not found' is executed.
This process has failure rules that save the error message in the UpdateData.ErrorMessage field and if the error message was 'Total Too High' the UpdatedBO.Total is set to -1.
FindUpdateData2 => just like FindUpdateData2 except executes NoFailureRules after the find.
NoFailureRules => just like WithFailureRules but (surprise) it does not have any failure rules.
To use this BSV:
load it into your Aware system and sign in as admin.
select the menu item "Create Test Data" to create the test data
select the menu item "Run No Failure Rules" to executd FindUpdateData2 and NoFailureRules. The first UpdatedBO will be updated successfully, but you will get an error "Total Too High" for the second UpdateBO and it will not be updated. Also the process will be terminated and the third UpdateData record will not be processed.
select the menu item "Run With Failure Rules" to execute FindUpdateData1 and WithFailureRules. No errors will be displayed, both UpdateBO records will be updated and the last 2 UpdateData records will have the errors saved in the Error Message field.
I do not use failure rules on processes run by users, since I want the user to see the error and let them choose what action to take. But I have multiple processes that run via the scheduler and they all have failure rules so that they run to completion even if there are errors.