Tony Olivas Posted October 21, 2009 Share Posted October 21, 2009 I am looking for a way to write an expression to error out when a certain field contains charcters too short or too long. Then print out the error message and not to compose file. Something to the effect of: if (Field("cert1") <= String("Character length")) { return "<span>" + String("Error out and print out ") + "</span>"; } return ""; Link to comment Share on other sites More sharing options...
Dan Korn Posted October 21, 2009 Share Posted October 21, 2009 You can call the Print or ReportError functions to write a message to your log (.msg) file. And you can set FusionPro.Composition.composeThisRecord = false in OnRecordStart to suppress composition of any given record. Link to comment Share on other sites More sharing options...
esmith Posted October 22, 2009 Share Posted October 22, 2009 Following Dan's suggestions, I came up with the following OnRecordStart rule: var ShortString = 6; //shortest # characters in chosen field var LongString = 24; //longest # characters in chosen field var CheckField = Field("Company"); //chosen field var CharCount = CheckField.length; //if record contains short or long field, it will not be composed, //and offending record will be noted in message log following composition if ((CharCount >= LongString) || (CharCount <= ShortString)) { FusionPro.Composition.composeThisRecord = false; Print ("RECORD " + CurrentRecordNumber() + " IS EITHER TOO SHORT OR TOO LONG!"); } In my test, 3 of 10 records did not compose, and my log following composition indicated which 3 records were left out. Link to comment Share on other sites More sharing options...
Tony Olivas Posted October 22, 2009 Author Share Posted October 22, 2009 Eric, That was awsome. It worked perfect. It even gave me a fatal error. Freaked me out!! Then again thats what it suppose to do. Thanks, You guys are the best. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.