Alteryx Designer Desktop Discussions

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

Updating Data Table Status Based on Matching Values from Status Table

pkirr
5 - Atom

I have a data table and a status table. My goal is to compare these two tables and update the status in the data table whenever there's a match with the status table. Importantly, not all columns need to match between the two tables. I want to avoid using the append function as it can lead to unnecessary data inflation. I'm considering using a macro to achieve this, but I'm unsure of how to set it up. Can someone provide guidance on how to create a macro for this purpose?

 

Status table

start dateend dateorigin idorigin countryservice levelcarrier scacstatus
2023-01-012023-12-3112345   exception
2023-09-012023-12-3155446 TL no charge
2023-04-012023-07-31 CAN ABCexception

 

Data table

create dateorigin idorigin countryservice levelcarrier scacstatus
2023-07-2455446CANTLABC

normal

2023-07-2555446CANLTLDEFnormal
2023-07-2512345USATLABCnormal

 

Thank you,

 

Paul

2 REPLIES 2
gawa
16 - Nebula
16 - Nebula

Hi @pkirr 

 

With the given context, not clear about your goal but I can advise a couple of general things...

 

When you compare two tables, first consider to use JOIN tool instead of Appendix Field. By properly selecting key field/s, it will not generate unnecessary records(and also not generating unnecessary columns by uncheck unnecessary columns in configuration of JOIN tool). For matched data from J-anchor you can change some data(in your case "Status"). After that, you just UNION data from L-anchor and J-anchor so as to retrieve the original format.

Record ID tool is useful to sort data in original order after a couple of JOIN/UNION operation, since original order will not maintain after those operations.

 

Refer to attached workflow for instance. In this case, first matched condition is equality of "origin_id" of two tables.

image.png

 

After then, if "create date" is between "start_date" and "end date", change status to one form another table.

image.png

Qiu
21 - Polaris
21 - Polaris

@pkirr 
What would be your matching creteria?

Aside from date, should we also consider one of the following or all of them?

origin idorigin countryservice levelcarrier scac
Labels
Top Solution Authors