JR9 Posted June 5 Share Posted June 5 I am trying to import data from a csv file containing multiple fields of all-caps data. The fields are First Name, Last Name, Address, City, etc. I would like to know if there is a way to convert every field of the data from all-caps to proper case using just one rule, or if I have to manually create multiple rules and apply them individually to each field. I am having trouble, because, as far as I can tell, rules have a single return value, and I do not know if there is a way to modify multiple fields using just one rule. Quote Link to comment Share on other sites More sharing options...
Douglas Cogan Posted June 5 Share Posted June 5 Hi JR9, We are working on a way in a future version that changes like this can be done without rules. We're trying to figure out a way that you can click on the variable in the text editor and mark that you want it caps, or formatted as dollars, etc. We certainly recognize it's not ideal to have so many rules just to capitalize things. One thing you can do is in OnRecordStart you can create new "variables" that are the upper case versions. Then use them in the text editor. For example, create a new OnRecordStart rule and add these lines: FusionPro.Composition.AddVariable("CapFirstName", ToUpper(Field("First Name"))); FusionPro.Composition.AddVariable("CapLastName", ToUpper(Field("Last Name"))); Then in the text editor, type in the variable CapFirstName in the variable list box. Then you can insert it: That previews like this: That way you don't have to make a rule for everything you want to capitalize. Like I said, though, we are looking into ways to do this without having to write any rules. Hopefully for version 14... Quote Link to comment Share on other sites More sharing options...
DSweet Posted June 6 Share Posted June 6 I know about the ToUpper() function, and I use it quite a bit. However, in regard to the name field(s) in proper case that JR9 wants to use, he could do the same thing with ToTitleCase() function ... but that would not be quite proper for names. "McDonalds" would come over as "Mcdonalds" and "JoAnn" would come over like "Joann". Somehow a repository of such names would have to be kept maintaining the proper casing of such items. . Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 12 Share Posted June 12 You could generalize Doug's solution to make an upper-case version of every data field, like so in OnRecordStart: for (var fieldName in FusionPro.Fields) FusionPro.Composition.AddVariable("Cap" + fieldName, ToUpper(Field(fieldName))); And you could do something similar with the ToTitleCase() function. However, I have to echo DSweet's warning about ToTitleCase. As I have also noted many times here on this forum, it's not possible to write a computer algorithm that can correctly "unmake the soup" of proper names which have been capitalized to go back to their original "proper" casing, as there are no strict rules about how names are capitalized, and the capitalization can be arbitrary. It's more art than science, and even with a database of common exceptions, a computer does not get to dictate to anyone how their name should be capitalized. It's not just names like "McDonalds" that you have to worry about, it's also names like "Mies van der Rohe", "O'Neil", "Leonardo di Caprio", and uncountable other possibilities, which are impossible to fully account for. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.