Problem building a path

redStriperedStripe Member Posts: 83
Hello,
I want to create a folder in specific path. The path-string I put with
some information from the item table together.

e.G.:
path := drive + '\' + TextVar1 + '\' + TextVar2 + '\' + TextVar3;

then I get an error when I use CreateFolder.
if I try this way...
path := 'c:\test';
...it works fine.

I think there is a problem with the '\'

btw I use Navision 4.0

Does anybody have an idea?

redStripe

Comments

  • krikikriki Member, Moderator Posts: 9,118
    redStripe wrote:
    path := drive + '\' + TextVar1 + '\' + TextVar2 + '\' + TextVar3;
    
    Are you sure "Drive" includes an ":"?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • redStriperedStripe Member Posts: 83
    yes I'm sure ... I just tested it again. :-k
  • WaldoWaldo Member Posts: 3,412
    A long shot:

    Try to use FORMAT('\');

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • krikikriki Member, Moderator Posts: 9,118
    When you create a complete subdir structure, you need to create it step-by step. So in your case:
    create "path := drive + '\' + TextVar1"
    create "path := drive + '\' + TextVar1 + '\' + TextVar2"
    create "path := drive + '\' + TextVar1 + '\' + TextVar2 + '\' + TextVar3;"
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • WaldoWaldo Member Posts: 3,412
    ah, indeed, didn't fully understand the problem. :oops:

    You can do it in one way with the filesystem-ocx ... but I don't think you want to use automation for this ... .

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • redStriperedStripe Member Posts: 83
    format('\') gives me the same result.

    sorry, I don't understand why it is not simple possible to put some strings
    with + together?
    If try to put some TextVars with + but without the '\' together
    everything is fine.
    ](*,)
  • WaldoWaldo Member Posts: 3,412
    Sorry man, i just wrote following code:

    result := test1 + '\' + test2 + '\' + test3 + '\' + test4;

    and the result is just fine in 4.0 and 4.0 SP1.

    Which build do you have?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • redStriperedStripe Member Posts: 83
    I use Nav 4.0
    Did you try to CreateFolder(result) ?

    in my path-Var stands the right path, but if I try to use
    CreateFolder ...it crashes :(
Sign In or Register to comment.