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.

Update Raw XML with Formula -- Use Cases

smoskowitz
12 - Quasar

Hi All --

 

I come here to you -- the smartest people in the room with a question about the topic listed in my subject. I am trying to figure out how Updating Raw XML with Formula could be useful.

 

What I am hoping it can do is dynamically update the formula. So here is a typical scenario. Each quarter, we might receive new financial information.

 

In Jan, Feb, March

2021 Q1 Balances

 

In Apr, May, Jun

2021 Q2 Balances

 

As you well know, if you write a formula like: 2021 Q1 Balances * .25 in Q2 that formual will break. However, if I can automate and update the filed dynamically, then the fomula will always be right.

 

Any thoughts on this or other use cases would be appreciated.

 

Thanks,

Seth

 
6 REPLIES 6
Qiu
20 - Arcturus
20 - Arcturus

@smoskowitz 

If 2021 Q1 Balances and 2021 Q2 Balances can share the same field name, it should be fine.

It would be better if you could provide some sample data and desired output and I am sure the people here would be happy to assist.

smoskowitz
12 - Quasar

Thank you @Qiu for your response.

 

I originally posted this in the General discussion board as I am not having a specific problem. What I outlined -- I have ways of managing -- but like all of us here - I was looking for something better or exploring a way to do something I haven't considered.

 

I guess what I was trying to do is start a conversation about potential ways for using the Update Raw XML with Formula functionality as it looks like it could be a powerful tool. I mean updating the formulas (for instance) before using them to calculate data seems like un-tapped potential and there doesn't seem to be enough documentation or guidance on that.

 

By including my rudimentary example, what I am thinking could be done is that I can is that if I build a formula that uses 2021 Q1 Balances - part of my workflow for next quarter could be to dynamically change the formula from Q1 to Q2 and then run my data through it as opposed to genericizing the field names.

 

Again, no specific issue, just looking to see if something better can be done by updating the raw Alteryx XML.

 

Thanks,

Seth

Brian_P
6 - Meteoroid

I don't know much about XML but could this be used to pass the folder path from a file selected using File Browse (the actual path selected, not the temp file path used in Gallery) to a Directory tool, or any other tool for that matter?

OllieClarke
15 - Aurora
15 - Aurora

Hi @smoskowitz 

 

I've used the Update Raw XML via formula before when I wanted to reorder/remove output fields based on a drop down connected to a sort. The chosen field would always be placed first in the output, which requires rewriting the xml of a select tool. 

 

I've attached a macro which takes this approach.

 

Hope that helps 🙂

smoskowitz
12 - Quasar

@OllieClarke Thank you! I will take a look.

 

Seth

bkclaw113
9 - Comet

I know this is a little late to the party, but a different approach be to just use REGEX to match the expected field name in a dynamic rename tool. So your expression in the dynamic rename would be:

If regex_match([_CurrentField_],"\d{4}\sQ\d\sBalance")
Then "Balance"
Else [_CurrentField_]
Endif

If you wanted to retain the original field name you could always use the same regex in a multi field formula to create a new_ field with the same data and then look for the new_ with regex in dynamic rename to keep the original field and have a copy in a generically named "balance" field

bkclaw113_0-1663065194057.png

 

Labels