Alteryx Designer Desktop Discussions

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

Previous Date Using Update Raw XML

sharduldolas1
7 - Meteor

Hi,

 

Can Someone help me to get the Previous date XML code. I have a radio button as Latest date, when I run the macro it should give me the result of current - 1 (previous date) data or max date data.

 

Thanks in Advance

6 REPLIES 6
BrandonB
Alteryx
Alteryx

DateTimeNow() can return the current date in a formula tool

 

DateTimeAdd(DateTimeNow(),-1,"days") will return yesterday dynamically. This formula can be applied to your max date as well if you want to figure out what one day before the last date is. 

sharduldolas1
7 - Meteor

Thanks BrandonB

 

it works.

sharduldolas1
7 - Meteor

Hi BrandonB,

 

Need your help in one of the XML code. I am writing to achieve the MAX date data. Please check my below xml code 

 

If [#1] then

'<Field name =MAX("Date Index") type="range"

begin='1800-01-01" includebegin="True" end="2999-01-01"

includeEnd="True" />'

else ' ' endif

 

Please help me know what is wrong in this code.

BrandonB
Alteryx
Alteryx

Is your goal to isolate the column that is the latest date? You could probably transpose the data, use a summarize tool to find the max date, append this back to the main data, filter to only pass through data that is the max date, and then use a formula tool afterwards to perform whatever operation that you need to do.

 

Is there a reason why you are taking the XML approach instead of just using Alteryx tools?

BrandonB
Alteryx
Alteryx

Example below and attached. Of all of the columns with different dates in the original data, this workflow transposes the data, figures out the max date, and only passes through the values of this maximum date. Because the data is now in a "Name" and "Value" structure, you can use a formula tool afterwards that doesn't need to reference a specific date column name because it will always be Name and Value. This allows for you to feed in data dynamically with a workflow that always performs the operations to each latest date column that is fed in. 

 

max date example.png

sharduldolas1
7 - Meteor

Thanks for the reply.

 

I am using xml because I am creating App using MACRO. The requirement is like there is a radio button as latest date, whenever user will run the app it will show the data of Max Date. 

Labels