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

Question

Question

Custom Query return not token option.

asked on April 19, 2016

doing a custom query to a SQL database Track Token returns the results:

customquery_department        Head Start

customquery_results found      True

customquery_result count        1

 

When I go to the next tool in the workflow which is Route Entry to folder,  I want to name the folder path based on the customquery_department  result.  But the customquery_department is not a token option.  Anyone know why?

0 0

Replies

replied on April 19, 2016
SELECT Department FROM [Class Codes]
WHERE ClassCode=%(RetrieveFieldValues_Class Code);

 

0 0
replied on April 19, 2016

0 0
replied on April 19, 2016 Show version history

You need to use the Parameters section of the query builder as you cannot just put tokens directly into the query. The below link gives an example what it might look like. This can vary slightly depending on the driver used. 

 

https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/Subsystems/LFWorkflow/Content/Resources/Images/Custom%20Query%20Editor%20ex1.png

 

When done, make sure the test option works and you should be good.

0 0
replied on April 19, 2016

Chase,

Please review this page which indicates that you have to test your custom query in the Workflow Designer and then you can use the column tokens inside a "For Each Row" activity.

Regards

0 0
replied on April 19, 2016

Sorry I don't understand how to apply the parameters.  They look like they are only useful for inputting into the query.

SELECT Dept FROM `Sheet2$`
Where Code = %(RetrieveFieldValues_Class Code)

This returns a value for Dept without inputting anything into the Query.  Pulling from an Excel sheet.

Why doesn't the same thing,  which is pulling the correct value for Department.  allow me to use the value returned for Department?

I don't get how to make a token and give it the value returned to Department.

0 0
replied on April 20, 2016 Show version history

Hi Chase,

To expose a parameter from SQL, it must be explicitly named. Change the script then cick "test" (on the SQL activity) to trigger Workflow Designer to refresh the token list.

SELECT Department as MyDepartment FROM [Class Codes] 
WHERE ClassCode=@ClassCode;

See the attached image. Note, my example doesn't use question marks as place-holders. This is because I'm using "Direct SQL Connection" and the sample in the documentation (referenced by John above) is using "ODBC Connection"

 

Done like this, and if you set the activity to return "first row only" you can also leave out the "for each row" activity.

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

Sign in to reply to this post.