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.

Reports, for loop, indexing column

madisonflesner
5 - Atom

I am trying to automate and format reports. Below is an example of what the data looks like. The issue is each question/answer is on its own row, and the policy summary info is repeated for each row. I need to be able to print out the policyholder name and other account summary info only once, but print out each question/answer for a report. How do I do this? Can I index by each group of policy holders?

 

I wrote out some pseudocode on how it could go but I'm not sure how to implement the looping?

CREATE new report

Uniques = [uniquePolicyName1, uniquePolicyName2, uniquePolicyName3]

FOR j=0: length(Uniques)

      APPEND TO REPORT summary info columns(j)

      FOR i = 0: count(Uniques(j))

               APPEND To REPORT question_column, answer_column where x = uniques(i)

      END

END

Export report to PDF

 

and it needs to print out as...

[Summary info]

[Q1]

[Answer1]

[Q2]

[Answer2]

[Q3]

[Answer3]

 

POLICYHOLDER_NAMEVISIT_REPORT_IDVISIT_REPORT_VISIT_DATEACCOUNT_CLAIM_REGIONFIELD_DEF_TEXTANSWER_TEXT
hebscere10/10/2010Austinheb question 1:heb answer 1
hebscere10/10/2010Austinheb question 2:heb answer 2
hebscere10/10/2010Austinheb question 3:heb answer 3
cvslkmpok12/12/2012Lubbockcvs q1:cvs ans1
cvslkmpok12/12/2012Lubbockcvs q2:cvs ans2
cvslkmpok12/12/2012Lubbockcvs q3:cvs ans2
walmartbgfgtr1/1/2011Austinwalmart q1:walmart ans 1
walmartbgfgtr1/1/2011Austinwalmart q2:walmart ans 2
walmartbgfgtr1/1/2011Austin

walmart q3:

walmart ans 3

 

I also tried pivoting the data, but I still don't know how to go about it.

1 REPLY 1
MatthewO
Alteryx
Alteryx

Hello @madisonflesner:

 

I believe the attached workflow may get you the output you are looking for. I hope this helps!

 

sort.PNG

Labels