Alteryx Designer Desktop Discussions

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

R error when writing to Alteryx

LFLee
8 - Asteroid

I'm writing a batch macro to parse the scanned pdf files and to write the output for each file to a separate tab in Excel. When the macro was run, it was able to convert the files in the folder it is reading. However, I've encountered this error, Error: R (4): The field layout changed between subsequent calls to write.Alteryx with the same connection (Output1), when it was trying to output to the Excel file.

 

Can someone help to solve this error and let me know how to write the output for each file to a separate tab in Excel?

 

8 REPLIES 8
ganesamurthy
8 - Asteroid

Did you modify settings in Interface Designer when output field changes based on configuration or data?

Can you please share me your workflow for further assistance on this?

Thanks.

LFLee
8 - Asteroid

@ganesamurthy , it was a standard macro and i've changed it to iteration macro when I hit the error but it still does not resolve the error. I've attached my workflow here. 

 

Appreciate your help on this.

ganesamurthy
8 - Asteroid

There won't be any iteration for a standard macro, I think you were trying to create a batch macro, you shall try my updated one in the attachment. If it works please check the difference in the settings in Interface Designer in View tab.

LFLee
8 - Asteroid

@ganesamurthy , thank you for your help. I've tried and still hit the same error. I'm just wondering if it is because i'm reading multiple pdf files from the folder using the macro at one go that is causing this.

 

Any assistance on this would be really appreciated!

 

ganesamurthy
8 - Asteroid
Can you please share me your few input pdfs along with your workflow?
ganesamurthy
8 - Asteroid

Problem is you should convert this text to a dataframe in R code before bringing it to the workflow. Here is the corrected R code:

 

for (file in files){
pngfile <- pdftools::pdf_convert(file,dpi = 200)
text <- tesseract::ocr(pngfile)
x <- data.frame(text)
write.Alteryx(x,1)
}

 

Hope this resolves your problem.

LFLee
8 - Asteroid

@ganesamurthy , thank you so much for your help! This works.

 

One more question, though, is there anyway I can get the output for each file to be saved as a separate sheet in one output excel file?

ganesamurthy
8 - Asteroid
Labels