Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Sort output sheets

jaimonsk
8 - Asteroid

Hi,

I was creating an app. There are 3 output excel sheets writing to the same file. Now all the 3 sheets are coming from 3 separate data streams and are of different structure and schema. I have used block until done tools to force write all 3 sheets into the same file. Now the problem is that the output sheets are not in the expected order. It needs to be arranged in an alphabetical order. But that is not coming as expected. I can't use reporting tools as per requirement.

I was wondering if there is any VBA or batch script which could do the sorting part once the workflow has completed running. We could call this script to do this sorting. But I don’t know VBA, and the only thing which could come up by checking several websites keeps throwing me errors while running it as standalone. Can someone help me to solve the issue?


Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("file path") 'insert link or URL to sharepoint document.
 Application.ScreenUpdating = False
             iSheets = Sheets.Count
             For i = 1 To iSheets - 1
                   For j = i + 1 To iSheets
                       If Sheets(j).Name < Sheets(i).Name Then
                           Sheets(j).Move before:=Sheets(i)
                       End If
                    Next j
             Next i
Application.ScreenUpdating = True
objworkbook.save
objexcel.quit

2 REPLIES 2
cplewis90
13 - Pulsar
13 - Pulsar

Hey @jaimonsk,

 

This looks like vbscript code and could be put into a workflow to run post the completion of the workflow.

 

If you click into white space on your workflow where you want this implemented, go to the configuration panel and find the "Events" tab. Once there you will want to hit add and then run command:

cplewis90_0-1623937610028.png

 

There are several good posts on setting up the run command for this like: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Run-Command-Configuration/td-p/469539

or you can configure it like the run command tool: https://help.alteryx.com/current/designer/run-command-tool

 

There are several blogs out there as well that helps configure the run command tool that could be implemented here as well.  

Emil_Kos
17 - Castor
17 - Castor

Hi @jaimonsk,

 

If you would be interested there is a tool called field sort. 

 

Emil_Kos_0-1623937991791.png

You can order the columns in ascending or descending order.

 

This tool is part of crew macro and you can download it from here: http://downloads.chaosreignswithin.com/Macros.zip

Labels