Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Extra spaces at end of lines writing text files

byagelski
8 - Asteroid

We have a use case where we want to use an analytic app to run a powershell query to return the members of AD groups.  We have a working Powershell query that is fed by a text file that sits in a network fileshare.  We'd like to allow the user to enter one or more AD groups and execute the query.  this means we need the app to write the values entered by the user to a text file.  The line ending is fine if just one AD group is entered.  if there are multiple lines written to the text file, there is additional spacing on each line which won't allow the Powershell query to match the AD group to our AD module.  I've replicated the error in an over-simplified example, which I've attached .  The posts I've found with Community searches seem to show issues with an extra line at the end of the output...but not issues with the ends of lines with data.  Anyone have any thoughts on how to solve?

6 REPLIES 6
apathetichell
18 - Pollux

I'm sorry but I'm not sure this is the correct attachment? It's just an input data an output data... I'd expect your app has a list box interface and some crosstab/input fun going into that. Then maybe a select tool? Something like that? The missing step is probably a summarize tool after your filter tool set to concatenate... That should be what you want to get multiple groups in one line.

 

Not sure on the syntax on your powershell command form there.

byagelski
8 - Asteroid

Thanks for the question @apathetichell, but this is the workflow I've created to isolate the issue I'm having.  The app input and all other pieces are working fine except when I want to write multiple values to the text file.  The problem is that I need the text file written by the output tool to write a line for each value (i.e. each AD group).  Each line needs to end immediately after the last character on each line.  Powershell is having trouble reading the values in the text file because of the extra spaces at the end of each line written to the text file.  Hopefully that makes sense and sorry for the confusion.

apathetichell
18 - Pollux

I usually see things like this written into .bat files in a formula tool following a summarize tool where you concat things you like. the only character after each string line should be a /n end of line character - but powershell may be reading it differently... If you concat via summarize tool and then use a formula too to put the finishing touches on your command  - you can get this as "one entry" so you won't have extra /n's or whatever... Does that make sense?

byagelski
8 - Asteroid

I have worked with .bat files a little but not enough to try and write some and then backfill how powershell read them.  here is an example of what our Powershell query is reading currently.

 

byagelski
8 - Asteroid

apparently the file did not attach.  it's attached here.

 

byagelski
8 - Asteroid

looks like the best solution I've found is to adjust the Powershell to expect a CSV file.  Then write a CSV instead of a TXT file with Alteryx.  Then I needed to use the Dynamic Rename tool to adjust the field name to the first row of data so that the header row isn't used in the Powershell query.  Cool stuff.

Labels