HI
So i want to make a simple alteration to the current Google Analytics Connector.
I added a line to the GUI.html to add an additional choice in the Preset Date Range.
<alteryx-option uiobject='XMSG("Auto Date")'>autodate</alteryx-option>
I then added a corresponding line in the Google Analytics macro in the formula tool that does the calc for which date should be inserted.
// startDatePicker logic based on predefined date dropdown
// ToDate selections end on the previous day
// Sunday is start of week
IF [preDefDropDown]="today" THEN DateTimeToday()
ELSEIF [preDefDropDown]="yesterday" THEN DateTimeAdd(DateTimeToday(),-1,'days')
//My Line added here
ELSEIF [preDefDropDown]="autodate" THEN do something
Save both files, click out of the connector and back in.
The choice appears in the gui, i select it and click out. When i come back to the connector, i am unable to change selection, and the next and previous buttons don't work.
*Update* - if i edit the xml of the tool and change the preDefDropDown back to one of the original values, then full functionality is restored.
There must be some loop or check in place for the gui against those preset values, but can't seem to find it.
Any Ideas?
Thanks
Solved! Go to Solution.
Ok so,
Whenever a pre-defined value is selected, it computes and populates the corresponding dates in the start and end date, and carries out a check. Hence why the gui freezes.
The set date function is found in the bundles.js line 61044 - 61137
Now anyone now how i would translate this alteryx formula line into reactjs?
Basically it checks if the day is Monday, in which case start date is previous Friday, else start date is yesterday.
IIF(DateTimeFormat(DateTimeToday(),'%a')='Mon', DateTimeAdd(DateTimeToday(),-3,'days'), DateTimeAdd(DateTimeNow(),-1,'days'))
Well this was fun,
ok so amended the bundle.js with a new function to carry out the autodate function and return the corresponding values.
So the Google Analytics Connector now has an 'autodate' preset which sets the date range to 'yesterday' except for Mondays where the date range is set to Fri to (and including) Sunday.
i've attached the relevant files if this is a feature you might at all find useful.