In trying to find an efficient method to query LF metadata in Workflow (without iterating through documents using the "Search Repository" activity) I've come across LFQL and it essentially sounds like what I am looking for. I've read the SDK info, the white paper, and anything I can find on the LF support site but have yet to see if it can be used in Workflow. Is it even possible to use LFQL in the SDK Script activity? I know I can query the tables directly via SQL and the Custom Query WF activity but was hoping to use this as it appears cleaner.
Question
Question
Answer
You can use it in the SDK Script activity. See the "Submitting LFQL Queries through RepositoryAccess" section in the SDK Help.
Any chance this can be worked into a Workflow Activity in a future version where we could paste in the LFQL query and the activity takes care of the rest? It could be similar to the Search Repository activity or a connection option for the Custom Query activity.
Any chance of LFQL being worked into a future activity similar to or part of the Custom Query activity?
Anything is possible in the future. What are you trying to do with the metadata for a batch of documents once you have it?
I have customers that are storing all student records based on their status (Active or Inactive). They are wanting every night to check every active student (10,000+) to see if they are still active and if not, move them to inactive. Additionally, they would like to check every inactive student (100,000+) every night to see if they have gone back to active. They have no field on their student records database to mark when a student's status has changed so I am having to cycle through all documents for active students to see if there status has changed. In most cases students have 30+ documents so I have two options:
- cycle through every document to see if they have changed
- put the student id's at the folder level as well and just cycle through the id's housed in those folders
I am wanting to just run a search to find the distinct student ID's within the Active Students folder which I can then use to query the students in the other application to find those that have changed. I run into this same issue with HR departments wanting employee documents to seamlessly move back and forth between active and inactive employees as the employee status changes. Maybe there is a better way to accomplish this. Can you think of more efficient way to go through thousands of students every night?
Do they have a SQL backend? Could you maybe add a trigger to their tables that logs the student ID somewhere when the status column is updated? Then you'd have a list of students updated within the last day.
I dont have access to their backend database and their vendor doesn't allow triggers. What I've done is just query the LF database via SQL and this should work to give me the distinct student ID's.
SELECT T1.tocid, T2.tocid, StudentID, DOW FROM
(SELECT propval.tocid, str_val AS StudentID
FROM propval
LEFT JOIN toc ON propval.tocid = toc.tocid
LEFT JOIN propdef ON propval.prop_id = propdef.prop_id
WHERE propdef.prop_name = 'Student ID' AND str_val IS NOT NULL) T1
left join
(SELECT propval.tocid, str_val, date_val AS DOW
FROM propval
LEFT JOIN toc ON propval.tocid = toc.tocid
LEFT JOIN propdef ON propval.prop_id = propdef.prop_id
WHERE propdef.prop_name = 'Date of Withdrawal') T2
ON T1.tocid=T2.tocid
I'm also needing to verify first name, last name, and Date of Withdrawal. Is there an easier way to query back all of the template values via a single query?
Hi Beau. Did anyone provide an answer for this? I am looking for a similar way to return a recordset of the oldest entries in a folder and make them available for a "for each" activity in workflow.
Thanks,
Kevin
I never got a direct way to get it through Workflow. I ended up writing a SQL query to directly query the SQL tables that hold the properties so that I only got the specific entries I needed. It is not the most elegant way to do this but it works.
Replies
Any word on getting an LFQL Workflow activity or updating the query activities so they can also use LFQL?
I'm having more and more workflows where I am cycling though hundreds/thousands of documents just to get a distinct list of values from the document's template. Any chance this LFQL functionality will be available via an activity in Workflow 10?
Not what I was hoping to hear but I appreciate the honesty so I can find other solutions. Along those lines, what is the recommended fastest way to retrieve the value of a single field from hundreds/thousands of documents?
This is when you don't already know where the document is, right? Search Repository and Find Entry/Entries both allow retrieving fields for the results in Workflow 9.2.1 (which was released this week).
I'm not quite clear on what the end goal is though...
That new functionality is an awesome addition that I am already using to speed up this process. What I am hoping to gain is in this scenario (although I have tons of other similar scenarios I would use it in):
Customer has an HR folder structure where they have 2 folders depending on the employee's status:
- Active Employees
- A
- Adams, Mary (12345)
- B
- A
- Inactive Employees
- A
- Mark Anderson (45678)
- B
- A
These customers are wanting nightly jobs that do 2 things:
- Move employees back and forth between Active & Inactive depending on their status in the HR system
- Update any employees who have information that has changed including but not limited to:
- First Name
- Last Name
- Department
- Position
Their HR system does not have a flag or date field that says when a record is updated so I am having to check every employee every night to verify their status and template data. That means running a query for every document that has an employee id which requires me to loop through them one by one. I am not wanting the document itself, all I am wanting is template data associated with the template so I can query the HR system to see if something has changed. For small organizations this is no big deal but if we are talking a company that has 5000+ active employees and 100,000+ inactive employees then that is a ton of looping just to get a list of distinct employee id's in Laserfiche. I understand that the queries to verify the data accuracy will take awhile no matter what but it shouldn't take long to get a distinct list of data from Laserfiche. In SQL I can query a database with this many records and get back a distinct list in a matter of seconds.
Other customers are wanting a list of which employees have not filled out a form. I then have to run a search for everyone who has turned in that form, get the employee id associated with it, and then query that against their HR system to determine who is missing. Once again, I understand this will not speed up the query process against the HR system but it would greatly reduce processing time and server Workload if we could query the data in Laserfiche directly instead of via it's associated document. I have requests for massive queries for Student Records, Invoice Processing, and a variety of other needs that could be sped up considerably with this built-in functionality. Laserfiche is a goldmine of data and often times customers are wanting to work with the data itself and not the document it's related to. It just seems odd that we can query all sorts of databases and that Laserfiche has its own query language (LFQL) but we do not have access to it without having to write custom scripts. I understand I can write a custom SQL query against the database (with a ton of Joins) or I could write a custom SDK script but those queries take forever to write (& are hard for the customer to support) and most customers do not want custom SDK scripts.