09-26-2016 09:04 AM
It's a LOT easier to eliminate errors at the source than to catch them later!
09-26-2016 09:05 AM
I know that you can't check for every human error, but the most common mistakes for us would be typos, so I want to have some sort of method to check for some of those typos...
09-26-2016 09:09 AM - edited 09-26-2016 09:09 AM
Understand and agree about eliminating errors at the source. But when you have thousands of lines in a csv file to sort through, it's very easy to miss a small mistake like a simple space character in between elements. But LV can be taught what the expected format is, and if the input differs at all, it can parse out the bad data and output the correct. Or is this not possible?
If it's not even possible, could I at least check to see if there is bad data in the input, and notify the user that the input data is bad?
Thanks,
SM
09-26-2016 09:13 AM
But if you can develop a system of data entry as I proposed above (or ANY kind of system that auto-generates the commands and parameters), you don't need to go through the CSV file to check for typos. RegEx can get very messy, as you already know, AND I can guarantee that it will just cause more headaches because it will invariably miss something because a human is no longer involved and you won't notice it.
09-26-2016 09:14 AM
RegEx isn't really for error checking, but more for parsing text that was already checked.
09-26-2016 09:20 AM
Ok so any ideas for a good method to check for the errors, then let RegEx parse it?
Thanks,
SM
09-26-2016 09:27 AM
I did have the idea of using the dropdown menus/some kind of ring + parameter controls, but it depends on just how many commands you have. e.g., if it was DOS commands, it's not going to work, but if it's a subset of, say, ten DOS commands, this could definitely work.
The menu select way is the most bomb-proof way I can imagine, but as I said, this could be somewhat cumbersome. Still, some diligent work on the front end could lead to relaxation on the back end. 😉
09-26-2016 09:31 AM
So not really sure what you mean by "ring + parameter controls"? Do you ahve any examples?
And again, I understand and agree that eliminating errors at the beginning is the easier way, but I have been instructed to do it this way, so I don't really have a choice...
Thanks for the help,
SM
09-26-2016 09:43 AM
Regexes can be part of the solution but here there are cases where you will not have a valid command string. The commands are packets of 3-4-4-2 values, if you have a string where a value is all bad characters as is error 5-6-7 of your error document what value will you use as a replacement? If there is a bas character mixed with a value is just removing these character will give the intended value?
In my opinion some typos and formatting can be corrected but with bad or out of range character the command shoud be rejected and a flag rised.
As a starting point you can use the following code.
Ben64
09-26-2016 09:59 AM - edited 09-26-2016 10:09 AM
Hopefully this gives you an idea of what I had in mind? (It was much easier than what I had explained, actually, since all the data was supposed to be numeric).
[edit] geez what happened to the wires? They looked okay when I uploaded it... [/edit]
No more danger of typos. (You can do more checking for ranges and stuff like ben showed.) This just shows parsing the first group, BTW.