nancyhutch Posted January 7, 2009 Share Posted January 7, 2009 What would be the rule that would verify number of characters in a field and return one value if less that 2 characters and another if more than 1 character? I have a data base where some of the first names are just an initial in which case I want to return the initial and their last name, else return their first name. Thanks for any help. Link to comment Share on other sites More sharing options...
Alex Marshall Posted January 7, 2009 Share Posted January 7, 2009 If you know the names of the fields you want to check, you can use this function: function NumNonEmptyFields() { var count = 0; for (var i = 0; i < arguments.length; i++) { try { if (Field(arguments)) count++; } catch (e) { //Print(e); } } return count; } You can call it with any number of parameters, like so: return NumNonEmptyFields("Home", "Fax", "Cell", "Office"); If you want to know the total number of fields present in the job (actually in a record of data), without knowing their names in advance, you can create an ExternalDataFileEx object to read the delimited text input file. Or you can wait for an enhancement in an upcoming release which will allow you to iterate through all of the fields in the job. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.