Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7190 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hey!

Have read earlier threads concerning naming an export file using a calc field and found them really interesting. Many have written about the solution Wim Decorte came up with and it seems really nice.

But I'm really a novice concerning this cmd command etc so I came up with a new question. Say I use this in a runtime solution. Then the end user will install the runtime anywhere he (or she) wants on the computer. Say I have a export folder in my solution. Now I can't specify the whole command since the runtime could be on C:/ or d:/ or whatever.

How can I solve this?

Thankful for all your help

/David Holmberg

ps. the original command looks something like this

"cmd /c move ""C:runtime folderexport.txt"" C:runtime folderexport" & DateField & ".txt"

ds.

Posted

Hey!

Have read earlier threads concerning naming an export file using a calc field and found them really interesting. Many have written about the solution Wim Decorte came up with and it seems really nice.

But I'm really a novice concerning this cmd command etc so I came up with a new question. Say I use this in a runtime solution. Then the end user will install the runtime anywhere he (or she) wants on the computer. Say I have a export folder in my solution. Now I can't specify the whole command since the runtime could be on C:/ or d:/ or whatever.

How can I solve this?

Thankful for all your help

/David Holmberg

ps. the original command looks something like this

"cmd /c move ""C:runtime folderexport.txt"" C:runtime folderexport" & DateField & ".txt"

ds.

Posted

Hey!

Have read earlier threads concerning naming an export file using a calc field and found them really interesting. Many have written about the solution Wim Decorte came up with and it seems really nice.

But I'm really a novice concerning this cmd command etc so I came up with a new question. Say I use this in a runtime solution. Then the end user will install the runtime anywhere he (or she) wants on the computer. Say I have a export folder in my solution. Now I can't specify the whole command since the runtime could be on C:/ or d:/ or whatever.

How can I solve this?

Thankful for all your help

/David Holmberg

ps. the original command looks something like this

"cmd /c move ""C:runtime folderexport.txt"" C:runtime folderexport" & DateField & ".txt"

ds.

Posted

Wim has a solution named after him... kudos! smile.gif

David, try using a command generated by the calc:


"cmd /c move "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & 

"export.txt" "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & "export" & DateField & ".txt""





To format the guts of this a little more clearly:



Substitute ( 

  Left ( 

    Get ( FilePath ) ; 

    Position ( 

      Get ( FilePath ) ; 

      "/" ; 

      1 ; 

      PatternCount ( Get ( FilePath ) ; "/" ) 

    ) 

  ) ; 

  "file:/" ; 

  "" 

)

But OK, i need a little help here. I have to substitute a backslash for a forwardslash, but i don't know how to do that in FM7 (and am too lazy to look it up!).

HTH,

Jerry

Posted

Wim has a solution named after him... kudos! smile.gif

David, try using a command generated by the calc:


"cmd /c move "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & 

"export.txt" "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & "export" & DateField & ".txt""





To format the guts of this a little more clearly:



Substitute ( 

  Left ( 

    Get ( FilePath ) ; 

    Position ( 

      Get ( FilePath ) ; 

      "/" ; 

      1 ; 

      PatternCount ( Get ( FilePath ) ; "/" ) 

    ) 

  ) ; 

  "file:/" ; 

  "" 

)

But OK, i need a little help here. I have to substitute a backslash for a forwardslash, but i don't know how to do that in FM7 (and am too lazy to look it up!).

HTH,

Jerry

Posted

Wim has a solution named after him... kudos! smile.gif

David, try using a command generated by the calc:


"cmd /c move "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & 

"export.txt" "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & "export" & DateField & ".txt""





To format the guts of this a little more clearly:



Substitute ( 

  Left ( 

    Get ( FilePath ) ; 

    Position ( 

      Get ( FilePath ) ; 

      "/" ; 

      1 ; 

      PatternCount ( Get ( FilePath ) ; "/" ) 

    ) 

  ) ; 

  "file:/" ; 

  "" 

)

But OK, i need a little help here. I have to substitute a backslash for a forwardslash, but i don't know how to do that in FM7 (and am too lazy to look it up!).

HTH,

Jerry

Posted

When you figure it out, please let me know.

The issue, for those who haven't grokked it, is that FMP7 interprets the backslash to mean "the next character is literal text." Thus, the code "/" is interpreted as "open-quote, html <&#34;>" and there is no close-quote. In FMP6 language, this would be equivalent to three quotes in a row.

Posted

When you figure it out, please let me know.

The issue, for those who haven't grokked it, is that FMP7 interprets the backslash to mean "the next character is literal text." Thus, the code "/" is interpreted as "open-quote, html <&#34;>" and there is no close-quote. In FMP6 language, this would be equivalent to three quotes in a row.

Posted

When you figure it out, please let me know.

The issue, for those who haven't grokked it, is that FMP7 interprets the backslash to mean "the next character is literal text." Thus, the code "/" is interpreted as "open-quote, html <&#34;>" and there is no close-quote. In FMP6 language, this would be equivalent to three quotes in a row.

Posted

I believe you've got it backwards (forgive the pun):P

Backslash is the escape character. As you say, the escape character means "the next character is literal text." Therefore, "" is interpreted as a single backslash.

There should be no problems with "/".

Posted

I believe you've got it backwards (forgive the pun):

Backslash is the escape character. As you say, the escape character means "the next character is literal text." Therefore, "" is interpreted as a single backslash.

There should be no problems with "/".

Posted

I believe you've got it backwards (forgive the pun):

Backslash is the escape character. As you say, the escape character means "the next character is literal text." Therefore, "" is interpreted as a single backslash.

There should be no problems with "/".

Posted

I see. That explains why i couldn't figure out how to do it -- i was fooling with the "/" portion of my calculation rather than the "" portion. Thanks, comment.

So, David, your calculation should be:


"cmd /c move "" & Substitute ( Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) ; "/" ; "" ) 

& "export.txt" "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & "export" & "DateField" & ".txt""

J

Posted

I see. That explains why i couldn't figure out how to do it -- i was fooling with the "/" portion of my calculation rather than the "" portion. Thanks, comment.

So, David, your calculation should be:


"cmd /c move "" & Substitute ( Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) ; "/" ; "" ) 

& "export.txt" "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & "export" & "DateField" & ".txt""

J

Posted

I see. That explains why i couldn't figure out how to do it -- i was fooling with the "/" portion of my calculation rather than the "" portion. Thanks, comment.

So, David, your calculation should be:


"cmd /c move "" & Substitute ( Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) ; "/" ; "" ) 

& "export.txt" "" & Substitute ( Left ( Get ( FilePath ) ; Position ( Get ( FilePath ) ; "/" ; 1 ; PatternCount ( Get ( FilePath ) ; "/" ) ) ) ; "file:/" ; "" ) & "export" & "DateField" & ".txt""

J

This topic is 7190 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.