Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Parsing PDF to Excel from Private Gallery with R Tool Error

Grub
6 - Meteoroid

I have a fairly simple PDF to Excel converter.  It is set up to focus on tables within the PDF and getting them into an Excel structure.  This is working nicely as long as I run it from my desktop.  I, however, would like everyone to be able to use this.  I am ok with the user having to run from a share drive (o:) but would rather them be able to select the file from anywhere.  The server account has been set up to recognize the "o:" drive, but I still get the same error:

 

Oops!

The job PDF to Excel did not complete successfully and resulted in the following errors:

  • Error in normalizePath(path.expand(path), winslash, mustWork) : (Tool Id: 34)
  • Execution halted (Tool Id: 34)
  • The R.exe exit code (1) indicated an error. (Tool Id: 34)

In the first formula tool, I have tried:

  1. replacing O: with the unc path
  2. replacing all "\" with "\\" 
  3. replacing all "\" with "/"
  4. both 1 and 2 - and 1 and 3
  5. Uploading to the server "User is not required to specify credentials"
  6. Uploading to the server "User must specify their own credential"

I know the output path has not been changed, but according to the error, I have never got that far.  How can I get this working on the server (in the Gallery)?  I would ultimately like the file to be created and the user download to desired location rather than exporting to "input" directory.

Thanks in advance.

7 REPLIES 7
PaulNo
10 - Fireball

Hi @Grub,

 

Is "O:" a local drive? If not, it will not work.

 

To check if issue is caused by the path, please try the following:

 

0. Backup your app

1. In Formula tool 46, create a new expression "FileExists" with the following:

FileExists([FullPath])

2. Modify R tool 34 with the following:

 

# read in the PDF file location which must
# be in a field called FullPath
data <- read.Alteryx("#1",mode="data.frame")

if (data$FileExists) {

# Use pdf_text() function to return a character vector
# containing the text for each page of the PDF
txt <- pdftools::pdf_text(file.path(data$FullPath))

# convert the character vector to a data frame
df_txt <- data.frame(txt)

# output the data frame in steam 1
write.Alteryx(df_txt, 1)
} else {
AlteryxMessage(paste("Path doesn't exist:",data$FullPath), msg.consts$ERROR, priority.consts$HIGH)
}

 

3. Upload new workflow to the Gallery and run it. It will show you what path is used.

 

Thanks,

 

PaulN

PaulNo
10 - Fireball

Hi @Grub,

 

Is O: a local drive? If not then it will not work.

 

For diagnostic purpose, could you please:

 

1. Backup your app

2. Edit the app in Designer and change the following:

  1. Add a new expression to Formula tool 46:

Name: FileExists

Type: Bool

Expression: FileExists([FullPath])

 

b. Replace content of R Tool 34 with:

 

# read in the PDF file location which must
# be in a field called FullPath
data <- read.Alteryx("#1",mode="data.frame")

if (data$FileExists) {

# Use pdf_text() function to return a character vector
# containing the text for each page of the PDF
txt <- pdftools::pdf_text(file.path(data$FullPath))

# convert the character vector to a data frame
df_txt <- data.frame(txt)

# output the data frame in steam 1
write.Alteryx(df_txt, 1)
} else {
AlteryxMessage(paste("Path doesn't exist:",data$FullPath), msg.consts$ERROR, priority.consts$HIGH)
}

3. Upload modified version to your private Gallery

4. Run app and share results

 

I would expect to see an error message with the path.

 

 

Thanks,

 

PaulN

 

 

Grub
6 - Meteoroid

O: is a Share drive, not a local drive.  I tried what you said and received the following error as you predicted:

 

The job PDF to Excel did not complete successfully and resulted in the following errors:

  • Path doesn't exist: In_5f18375b19550000dc01e3ab\\dck20150713171045 07.2014 - 06.2015 purchased gas costs.pdf (Tool Id: 34)
  • The Target stream was not properly initialized. (Tool Id: 35)

 

I also tried the UNC path as you suggested, but received the same result.

 

Is there any other way, using any other tools, to allow some folks to utilize this conversion?  can I use the Command Line tool or the like to make the server/Gallery connect??  

 

PaulNo
10 - Fireball

Hi @Grub,

 

As a workaround, what about replacing the File Browse tool by a Text Box tool instead of ?

As per documentation, File Browse is not supported in the Gallery (https://help.alteryx.com/current/designer/file-browse-tool).

 

I appreciate that this is not as neat as your original solution but, used with UNC paths, it could work as a workaround.


Best,

 

PaulN

aschrubey
5 - Atom

I'm having the same issue. I am using the R package PDFTools to parse a PDF. It works perfectly on Designer but errors in Gallery. In addition to what you've tried I also tried to instead of a File Browse use a Text box and paste in the full path but still receive the same errors.

 

  • Error in normalizePath(path.expand(path), winslash, mustWork) : (Tool Id: 29)
  • Execution halted (Tool Id: 29)
  • The R.exe exit code (1) indicated an error. (Tool Id: 29)

 

If you figure out a solution, please let me know! Thanks!

PaulNo
10 - Fireball

Hi @aschrubey,

 

Could you please try suggested modified R code along with Text Box tool to confirm what path R tool is trying to access?

 

Thanks,

 

PaulN

Grub
6 - Meteoroid

PaulNo,

Thank you for your help in capturing the error from the R tool really helped me get past a hurdle.  I had a light-bulb moment.  I copied the file to a local working directory local to the server with the Run Command Tool.  You will need 2 directories, 1 for the .bat file (C:alteryxbat) and 1 for the destination (C:alteryxwork) or some other local directory.  We will then delete the files every night or bake it in to the end of the workflow - haven't really thought that through yet.

 

Please see my attached workflow.  Let me know if you see any glaring issues with it.

Labels