I have a task to validate a flat file (.csv)
In first step to parse this file, I create flat file dictionary and schema… - all OK. In second step I study how to validate flat file with ‘standard’ instruments (described in Flat file user manual). As I see - this methods is primitive and not pass to me, because I neet to check date field (in format yyyyMM) in document and many decimal fields. My question is how to validate that document without java-programming (if it possible). Please describe for me step-by-step how I can do this or maybe you have good user manual, where this process described in details. I need to know a best practice…
I’m using WM Developer/IS 6.5
you can use formatting service to check the date fields etc.Actually you will call a format service for a single field say date (in your case) . You will set this format service in your ff schema.Click on the field and set the custom format service on properties panel .Refer to
Flat File Schema Developers Guide.pdf for more info .
Since you are looking to validate not only the presence of data, but also its format, the best thing that comes to mind is using an xsd. Create an xsd containing all the restrictions, patterns, allowed values (enumerations), and once you convert the flat file to an IS document using the ff dictionary/schema, validate the IS document against the xsd.
Since you would most likely want to validate the contents upfront, your xsd will correspond to the flat document corresponding to ff-schema.
There may be better ways - but from top of my head, this approach is reasonable and flexible (you can add/delete/modify conditions by simply changing the schema).
Hope this helps,
if I right understand I can create xsd schema to validate my flat file, such as:
But I’m not understand how to use it…
This schema I need put to folder with my flat file dictionary, and the dictionary use it automatically? Or I should use this schema as FormatService for my data fields? Please help to understand…
What are trying to format and validate. If its an simpler formatting like changing the date format i think its better to format it in flat file schema using format service tab as mentioned by anil. Also if you are using the webMethods EDI Module, you can use the built–in format
services provided in the WmEDI package to format fields.
Below are steps you should follow in case you are using XSD to validate the document.
- Create flat file Dictionary and Flat Schema
- Convert it to document using convertToValues service.
Above two steps would convert your flat file into the IData document. Now as per taurean way you should be validating and formatting this IData document. For this :
3) Create a XSD schema. From File —> New ----> Schema. You can create XSD schema from XML document or from existing XSD or from DTD.
4) After creating the schema validate your IS document using pub.schema.validate service.
Thank you for fast reply - now I understand
In user manual not described how to create FormatService (just writed that is possibe :)) and how to use XSD schema also…
Thanks for you help!!!