You are viewing limited content. For full access, please sign in.

Question

Question

Find entry extension for a text file doesn't work

asked on October 4, 2022

Hello, I have a workflow that is sending files to a folder on a remote server. Everything was working just fine until I tried a text file. Technically, my script was able to export the file but I then run a SQL statement with the full path to the file I just exported including the file extension. I use the Find Entry activity to get the extension and I noticed that its blank.

Why does this not work? 

0 0

Replies

replied on October 4, 2022

It looks like this is an image document, but where the pages have text and not images. That is different from an electronic document, where the edoc contents are text. Only electronic files have extensions.

0 0
replied on October 4, 2022

To expand on what Brian said, by default, txt files get imported as text pages into Laserfiche, so there is no extension. You can use a "has (text) pages" search instead.

2 0
replied on October 4, 2022

Ya, hear you. I need my process to act like this text file is an electronic document. I can build in rules to my workflow to handle this. 

I also had issue with users uploading the resumes in Text file format so my resolution there was to not allow text files. It was confusing my HR folks when they went to open the resume. 

Thanks. 

0 0
replied on October 4, 2022

Quick thought on this Lucas, though you may have already handled it. I have a script that I'm using to export things similar to you. I basically have it checking if it's an e-doc, if not does it have image pages, if not export text. Here's the gist:

if(docToExport.IsElectronicDocument)
{
	//export as edoc
}
 else
{
	bool hasImages = false;
	pageCount = docToExport.PageCount;
	foreach(PageInfo currentPage in docToExport.GetPageInfos())
	{
		if(currentPage.HasImage == true)
		{
			hasImages = true;
		}
	}

	if(hasImages)
	{
		//export as image doc
	}
	else
	{
		//this exports all the text pages into a txt file
		var allText = new List<string>();
		string currentText = "";
		expExt = ".txt";
		foreach(PageInfo currentPage in docToExport.GetPageInfos(docToExport.AllPages))
		{
			if(currentPage.HasText)
			{
				using(StreamReader textReader = currentPage.ReadTextPagePart())
				{
					currentText = textReader.ReadToEnd();
					if(currentText.Length > 0)
					{
						allText.Add(currentText);
						pagesExported++;
					} //end if text actually found
				} //end using streamreader
			}
		}//end iterating through each page

		try
		{
			File.WriteAllLines(fullPath + fileName + expExt, allText);
			exportSuccess = true;
		}
		catch(Exception e)
		{
			exportNotes = "Error exporting TXT: " + e.Message;
		}
	}//end else TXT file
}

 

2 0
replied on October 5, 2022

Thanks, my export script is working. The issue was the Find Entry activity not returning a value for the extension. I got my fix in place. 

Thanks. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.