Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am familiar with keepchar, purgechar, and a few other methods utilized to deal with special characters with normal fields; however, my documentpath and file name have an apostrophe in them and are loaded using variables.
//Client name in this case is Bob's Apples and the code knows to automatically look in a preceding folder to find the client name.
/*Code to define your client name based on folder structure--works fine
Let vClientName = SubField(DocumentPath(),'\',substringcount(DocumentPath(),'\'));
// 2 files loaded from 2 different folders depending on which step of the process were in (1 or 2)...these also load fine for Bob's Apples
Let vStepOneFile = chr(39) & 'T:\clients\$(vClientName)\1-Actuals\Actuals Final.xlsx' & chr(39);
Let vStepTwoFile = chr(39) & 'T:\clients\$(vClientName)\2-Benchmark Rates\Benchmark Rates Final.xlsx' & chr(39);
//These fail when my client name has an apostrophe, such as the case with Bob's Apples. It accounts for the apostrophe when i set the client name variable, as well as when i load the files from a folder name WITH an apostrophe, but thats it.
Let vStepOneFileExists=if(FileSize($(vStepOneFile))>0,-1,0);
Let vStepTwoFileExists=if(FileSize($(vStepTwoFile))>0,-1,0);
The error i get reads:
Syntax error
Unexpected token: 's', expected nothing
Let vStepOneFileExists=if(FileSize('T:\clients\Bob'>>>>>>s<<<<<< Apples\Actuals\Actuals Final.xlsx')>0,-1,0);
Any ideas?
Nice solution as always from Sunny. Note that you can get the last folder in the path by using a negative index in substring:
SubField(DocumentPath(),'\',-2)
A little neater than the substringcount().
-Rob
Thanks Rob!!! Looking forward to meeting with you at the Qonnections