Use a variable in an export path
Bruce Easton
bruce at stn.com
Mon Apr 20 10:36:11 PDT 2015
On 4/20/15 1:13 PM, Chris Sellitto wrote:
>> Hi All,
>>
>>
>>
>> I have an export where I'm setting the export path. Currently I am
>> hard-coding the path for each user that needs to access the export so it
>> goes to their user folder on our windows server. filePro is installed
>> on
>> CentOS 6.2. I can get the name of each user using a variable in filePro
>> but I don't know how to insert the variable into the path. Below is a
>> sample of how I've tried it but it's not working. nm is the variable
>> that holds the user's full name and fn is the variable being used for
>> the file name.
>>
>>
>>
>> fn="/appl/user_exports/users/'nm'/filepro/export.txt"
>>
>>
>>
>>
>>
>> openit subroutine:
>>
>> export ascii file=(fn) r=\n f=|
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Josh Reader - Systems Analyst
>>
> [...]
>
> Josh,
>
> Please explain, "it's not working"? Are you receiving an error?
>
> I am not familiar with CentOS, but shouldn't the syntax be as follows?
>
> fn="/appl/user_exports/users/'{nm{'/filepro/export.txt"
>
> Notice the brackets around variable NM.
>
> Chris
> _______________________________________________
I'm assuming that "nm" is a filepro dummy field. Base on that you
simply need:
fn="/appl/user_exports/users/"{nm{"/filepro/export.txt"
However, since you mention "nm" have values representing names, I'll also assume that your "name" directory names may have spaces in them. If that's true, then you'll need quotes around what may have spaces, and since it would be in this string, you would need to backslash those double-quotes (for filepro's interpretation):
fn="/appl/user_exports/users/\""{nm{"\"/filepro/export.txt"
I'm not sure this works across all *nix, but using single quotes (instead of backslashed doubles) also worked for me on one unix box:
fn="/appl/user_exports/users/'"{nm{"'/filepro/export.txt"
But you definitely need double quotes up against the braces surrounding the dummy field for filepro to understand how to concatenate the string.
Bruce
More information about the Filepro-list
mailing list