Back to forum list… Back to How Do I?...

Move File - issues with expando fields in file path (10 replies and 3 comments)

Arline Welty
4 years ago
Arline Welty 4 years ago

Hi there,

Looking for some guidance on the Move File task. I'm trying to use expando fields in my source & destination directories but can't quite get it working. I can successfully move a file when I hard code the source & destination directories. 

I've gone down 2 routes when trying to use the expando fields in the directories. Here's an example with source directory:

  1. \\networkshare\GroupDocs\Accounting Share\Customer Invoices\%[CUSTOMER]\%[YEAR]  (Here I just tried to grab the fields from my transform and insert them as part of the path) When I try this I get the error "
    Could not find a part of the path '\\networkshare\GroupDocs\Accounting Share\Customer Invoices\%[CUSTOMER]\%[YEAR]'."
    2. I've also tried creating a single field that has the entire path in it, called SourceDirectory. In the Source Directory field I put "%SourceDirectory"

    "Could not find a part of the path 'C:\Windows\system32\%SourceDirectory'."

Attached is what I'm working with. The field %SourceDirectory looks right to me in the map transform.

Any ideas on how I could better get this working?

https://www.realisable.co.uk/wp-content/uploads/2020/07/2020-07-06_6-03-50.png
Support
4 years ago
Support 4 years ago

Arline, remove the value from Source Directory and simply enter into the Source File either:

\\networkshare\GroupDocs\Accounting Share\Customer Invoices\%[CUSTOMER]\%[YEAR]\*.pdf 

OR

%SourceDirectory\*.pdf

 

Arline Welty
4 years ago

Weird, something must be wrong for me still. I tried both those with these results:
Testing with:
\\networkshare\GroupDocs\Accounting Share\Customer Invoices\%[CUSTOMER]\%[YEAR]\IN00003.pdf (I was just testing with a single invoice to see if I could move it)
That gave me this response:
Ill-formed field at position [54] of string - \\echofs\GroupDocs\Accounting Share\Customer Invoices\%[CUSTOMER]\%[YEAR]\IN567643.pdf . The field must in the form ..
So position 54 is right when we have the field: %[CUSTOMER]
Then I tried the next approach and limited it again to a single PDF:
%SourceDirectory\IN00003.pdf
The response was:
The path is not of a legal form.

So since it's still working when I hard code the path, what do you think I must be doing wrong?

Arline Welty
4 years ago

Scratch that, I reviewed Errors.txt - looks like if I use the full RecordID.FIELD naming convention, it's happier!

Arline Welty
4 years ago
Arline Welty 4 years ago

I'm getting new errors on the destination directory.

Again, it works fine when I hard code the path. It's having trouble building the file path and I can't understand why.

I cleared the values for "Destination Directory"
I added a couple variations for "Destination File"

I've tried these both for destination file:

\\networkshare\groupdocs\Sage300\ECHOAP\Customers\%[Record.CUSTOMER]\Invoices\%[Record.YEAR]\HC\%FILENAME%FILEEXT

\\networkshare\groupdocs\Sage300\ECHOAP\Customers\%[CUSTOMER]\Invoices\%[YEAR]\HC\%FILENAME%FILEEXT

 

Here's what I see in errors.txt for both:

2020-07-06 09:47:40:706 - System.IO.DirectoryNotFoundException: Could not find a part of the path '\\networkshare\groupdocs\Sage300\ECHOAP\Customers\%[Record.CUSTOMER]\Invoices\%[Record.YEAR]\HC\IN567643.pdf '.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at Realisable.Data.Transform.TransformTaskFile.ProcessFiles(Boolean copyFiles)
at Realisable.Data.Transform.TransformTaskFile.Process()
at Realisable.Data.Transform.TransformControllerInterop.Process()

2020-07-06 09:49:28:047 - System.IO.DirectoryNotFoundException: Could not find a part of the path '\\networkshare\groupdocs\Sage300\ECHOAP\Customers\%[CUSTOMER]\Invoices\%[YEAR]\HC\IN567643.pdf '.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at Realisable.Data.Transform.TransformTaskFile.ProcessFiles(Boolean copyFiles)
at Realisable.Data.Transform.TransformTaskFile.Process()
at Realisable.Data.Transform.TransformControllerInterop.Process()

 

Arline Welty
4 years ago
Arline Welty 4 years ago

Any suggestions on handling the destination directory differently?

Support
4 years ago
Support 4 years ago

Can you please provide a screenshot the File Task?

Arline Welty
4 years ago
Arline Welty 4 years ago

Here it is- thank you.

https://www.realisable.co.uk/wp-content/uploads/2020/07/MoveInv.png
Support
4 years ago
Support 4 years ago

Arline, we have reviewed and you cannot do want you want to.

The destination folder or file do not support Expando fields; only the Source File does.

You can only use the %FILENAME & %FILEEXT in the destination file.

The reason is due to the way we process file requests.

Arline Welty
4 years ago
Arline Welty 4 years ago

Oh deary me. What are my options, in that case? Wondering if I could use a function- you showed me how to use a file task to create network file folders at one point. Could I use a modified function to accomplish this?

Mary O'Connor
1 year ago

Hi Arlene, I know this is ancient, but have you got move file working reliably using expando fields for both source and destination? If so are you prepared to share your solution?

Support
4 years ago
Support 4 years ago

This feature has been added to v4.2 PU4.

Mary O'Connor
1 year ago
Mary O'Connor 1 year ago

Hi Arlene, I know this is ancient, but have you got move file working reliably using expando fields for both source and destination? If so are you prepared to share your solution?

Arline Welty
1 year ago
Arline Welty 1 year ago

Mary, try upgrading your Iman instance as a first step, since Iman support says that this feature is part of v4.2PU4.

Or you could always try putting the whole dynamic path in a single field, which is what we've been standardizing on. Use a map transform, create a new field called "FilePath" for example, and use the map transform to build the full file path in that field. Then in your file task you can just add the new field %FilePath as the directory.

Good luck

Contact

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Request Demo

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Access Downloads

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close