malmazan Posted November 21, 2012 Share Posted November 21, 2012 Hi all! I'm super new to this -- -- I just went to training in early November and this is literally my second time using FusionPro for a real job -- so if this has already been answered please direct me to the right thread as I cannot find it. I'm not even sure it's possible. The CSV file I have for my job has one "Name" field and within that field, the names are formatted as such: "ADAMS, MARGO" and I want that to return "Margo Adams". I was able to use a basic rule to fix the all caps problem, but I have NO CLUE on what javascript to write to force anything after the comma to go first and anything before the comma to go last then delete the comma. I think I need the JS to include the Title Case functionality as well as the correct formatting functionality, correct? It seems like this might be a fairly common issue with customer-provided lists, so if it's not possible, I'm A-OK with telling the customer to fix their formatting. Thanks so much for your help! Quote Link to comment Share on other sites More sharing options...
esmith Posted November 21, 2012 Share Posted November 21, 2012 var fullName = Field("Name").split(", ").reverse(); return ToTitleCase(fullName.join(" ")); Of course, this is dependent on EVERY record having a value of [LAST, FIRST]. If any record has first name first, or is not separated by a comma-space, or has a middle initial, the result will be incorrect. Sometimes it is advisable to make data changes "upstream" in the process (i.e. in a spreadsheet app before linking in FusionPro). Quote Link to comment Share on other sites More sharing options...
malmazan Posted November 26, 2012 Author Share Posted November 26, 2012 Eric -- THANK YOU SO MUCH. This Thanksgiving, I am thankful for you! I did have a bit of clean up to do in the database, but nothing a find-and-replace doesn't fix quickly. I will keep this code forever! Thanks for your help and quick reply! Mariah 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.