Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Dynamic Input Cross Tab creating a unique identifier

Kutay
7 - Meteor

Hello Everyone,

 

I have a dataset with this format 

RecordJSON NameJSON Value String
10.adtagID6565
20.distinctpageseen1
30.firsttimeseen2020-02-05
40.lasttimeseen2020-02-05
51.adtagID6587
61.distinctpageseen1
71.firsttimeseen2020-02-05
81.lasttimeseen2020-02-05
91.profiletime1

 

and convert it into sth like this by using text to columns function for "json name" and then use cross tab .

RecordAdTagIDDistinctpageseenfirsttimeseenlasttimeseenprofiletime
1656512020-05-052020-05-05N/A
2658712020-05-052020-05-051

 

The problem is that I get same document every week with same "json name" column. If I use a directory and dynamic input to automate the process I get duplicated values as i have for week1.report  for example "0.adtagID" with a value and for week.2.report  "0.adtagID" with another value. How can I create a unique identifier for each documents coming from dynamic input automatically (such as file name ) so that I can solve this problem ?

 

Problem looks like this:


Week 1

 

RecordJSON NameJSON Value String
10.adtagID6565
20.distinctpageseen1
30.firsttimeseen2020-02-05
40.lasttimeseen2020-02-05
51.adtagID6587
61.distinctpageseen1
71.firsttimeseen2020-02-05
81.lasttimeseen2020-02-05
91.profiletime1

 

Week 2:

 

RecordJSON NameJSON Value String
10.adtagID6565
20.distinctpageseen3
30.firsttimeseen2020-02-12
40.lasttimeseen2020-02-12
51.adtagID6587
61.distinctpageseen5
71.firsttimeseen2020-02-13
81.lasttimeseen2020-02-13
91.profiletime6

Crosstab:

RecordAdTagIDDistinctpageseenfirsttimeseenlasttimeseenprofiletime
16565,65651,32020-05-05,2020-05-122020-05-05,2020-05-12N/A,N/A
26587,65651,52020-05-05,2020-05-132020-05-05,2020-05-131,6

 

Solution that I am looking for :

RecordAdTagIDDistinctpageseenfirsttimeseenlasttimeseenprofiletime
1656512020-05-052020-05-05N/A
2658712020-05-052020-05-051
3656532020-05-122020-05-12N/A
4656552020-05-132020-05-136

 

 

Thank you all for your help ! 

5 REPLIES 5
grossal
15 - Aurora
15 - Aurora

Hi @Kutay,

 

you can pass a field through the Dynamic Input, e.g. the file name.

 

grossal_0-1587923743627.png

 

This file name + the Record ID could be used as an unique ID and you could use a normal RecordID Tool in the end to get "real" Record numbers instead of your unique IDs.

 

Best

Alex

AbhilashR
15 - Aurora
15 - Aurora

Hi @Kutay, you could modify the Output File Name as Field option in the Dynamic Input tool to File Name Only to retrieve the file names of incoming files.

 

AbhilashR_0-1587923892676.png

 

EDIT - I have included a sample workflow for you to look through. Below is an image of the workflow setup I have to bring in the FileName.

AbhilashR_0-1587924293564.png

 

 

Kutay
7 - Meteor

Hi Alex thank you for your help. I tried your solution but got that  error "at least one modification must be specified"

 

Kutay_0-1587924273780.png

 

grossal
15 - Aurora
15 - Aurora

Ohh sorry, I forgot that you have to use the 'Replace a String' option to avoid this.

 

grossal_0-1587924615805.png

 

Just write some random String and choose a field of your choice (ideally not the filename, but something else). This will allow you to pass a field.

Kutay
7 - Meteor

It worked perfectly. I just added the File Name also in the cross tab function to group by and got the desired output. Thank you so much  !! 

Labels