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

Question

Question

Workflow Custom Query sort order

asked on August 13, 2019

 I have a read only excel source document.  I want WF to sort the results of the Query and put employees in a certain order?  I currently use just Query Data  and it returns the employees in the order they were entered into the data source.

I want to sort by "Rank" and also "Date of Rank" so it will create a list of employees in a our hierarchy order?  I'm guessing it involves a custom Query but have no clue were to start?  Can anyone help?  Thanks John

Capture.PNG
Capture.PNG (21.13 KB)
0 0

Answer

SELECTED ANSWER
replied on August 13, 2019 Show version history

Hi John

For a Custom Query with a SQL Connection, it could look like this

SELECT * (All Columns) from the Table, you can change this to specific fields by naming the fields such as SELECT [Column1 name], [Column2 name]

FROM TableName in the DBO selected

WHERE is what you are Querying on. I created the Parameter name on the left to use in the statement, Parameter value is the token from your workflow that contains the data for the query. You need to proceed the Variable name with an @

Order By ColumnNames    use asc or desc to choose whether the column is ascending or descending, sort by additional columns by separating the additional Order columns by a comma (,)

Highly recommend you have a look at https://www.w3schools.com/sql/default.asp to learn more about SQL statements. They also provide good content for CSS, HTML, etc

As an FYI, a Custom Query in Workflow looks slightly different based on whether you use a SQL vs an ODBC connection. I recommend a SQL connection

For a ODBC connection you replace the Parameter Names with a "?" and have to have them in the order in which those variables appear in your statement

 

Hope this helps

2 0
replied on August 13, 2019 Show version history

Ok that works Steve!  One question though say I want the query to look for a value that starts with  something.  We have Radio numbers that start with 13A, 13E and 13D. 

 

I get no data back on the attached pic???

 

Thanks John  

Replies

replied on August 14, 2019

Thanks Steve!!!

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

Sign in to reply to this post.