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.
SOLVED

Dynamically select columns based on metadata file

Willox
5 - Atom

Hey all, 

 

Apologies if there is a solution out there for this one already, I wasn't able to dig anything out that sounded appropriate.

 

I have a peculiar situation here, in that I have a large raw data dump from one of our systems that contains test results data. It's flattened so there is a row per person and looks something like this:

Dataset 1

PersonTest typeTest type component 1 nameTest type component 2 markTTC 2 nameTTC 2 markMisc. data 1 nameMisc. data 1 valueMisc. data 2 nameMisc. data 2 value
1Maths Algebra4Trigonometry5Shoe size 10Age4
2EnglishGrammar5Spelling8Native LanguageFrenchNULLNULL

 

There are plenty more columns along these lines...! I have received a file of metadata from the administrators of this data explaining exactly which fields are relevant for reporting purposes.

 

It looks like this:

 

Dataset 2

Test Type 

Field Name

Test ComponentRelevant for reporting?
MathsTest type component 1 nameAlgebraYes
MathsTTC 2 nameTrigonometryYes
MathsMisc. data 1 name Shoe sizeNo
EnglishTest type component 1 nameGrammarYes
EnglishTTC 2 nameSpellingYes
EnglishMisc. data 1 nameHair colourYes

 

Effectively I need to transpose dataset 1, using the metadata, to a file that looks like this:

 

PersonTest Test Component

Mark

1MathsAlgebra4
1MathsTrigonometry5
2EnglishGrammar5
2EnglishSpelling8
2EnglishNative LanguageFrench

 

This means I need to dynamically select which columns to transpose based on dataset 2, selecting those only where the Field Name = Column name, the value in the field = Test Component and the relevant for reporting field = Yes.

 

Is there a way to do this?

2 REPLIES 2
danilang
19 - Altair
19 - Altair

Hi @Willox

 

Here's a workflow that does your mapping.  As opposed to your idea of dynamcially choosing which columns to transpose based on the mapping, the trick here is to transpose them all into 2 groups first.  The Names columns (TTC 2 Name, Misc. data 1 name, etc) and the corresponding Value columns.  Then join these to have a series of records having one name and one value each.  Then it's a simple join to your mapping table to pull out the records you're interesting in.

 

Note: I added a record into your mapping table to pull the "French" record.

 

Solution.png

 

Dan

Willox
5 - Atom

Thanks Dan, this should do the trick!

Labels