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

Discussion

Discussion

Searching with SQL

posted on July 27, 2021

Hello Everyone, 

I'm working on a project to better integrate Laserfiche with our main business software. Currently, I have it configured to use a Web Access search string to pull a document up. The problem with this is that 2 tabs open when my user clicks the link. The first tab is the search results, the second tab is the document that it finds. I would much rather use a direct link to the document so only 1 tab opens or so I can open the document in an iFrame. The problem is that my system doesn't know what the entry ID is. That is the missing data point. 

So I was trying to get an HTTPS GET request working with workflow and after many failed attempts, and some research, it looks like that idea is not possible. I can set up a database connection in my main software so if I had a custom view configured with all my documents (at least the ones this program would access), I could use a SQL select statement and get the entryID back and construct my URL behind the scenes so that opening a document would be much more seamless. 

I have also tried using a connector but it won't work because of the way my new system creates its URLs. (not unique to the system the user is in.) What I am building is very similar to the feature that Connector provides giving that you would click a button and return the document. Simple right? 

Any help or guidance is appreciated! 

 

0 0
replied on July 28, 2021

Hello Lucas,

 

The below could answer your question, this SQL query uses tables, toc for entries, propval for fields values.

you can get the fields ID (prop_id) from propdef table

 

select t.tocid
from toc t
inner join propval p on p.tocid = t.tocid and p.prop_id = 96 and p.str_val='Human Resources' --Department
inner join propval p2 on p2.tocid = t.tocid and p2.prop_id = 98 and p2.str_val='Riley Recruiter' --author
inner join propval p3 on p3.tocid = t.tocid and p3.prop_id = 130 and p3.str_val='Template' --DocumentType

I am using this query to search for documents having department = "Human Resources" and author = "Author" and document type = "Template"

Hope it helped.

Maher.

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

Sign in to reply to this post.