This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I had some help from in here trying to create an itterative macro. And ive seen all the video's today in here, but I still cant make it work 😕
I have 2 dataset: 1. Purchase with a weigh (calcweight). 2. Priceagreement with a weight band ex. 0-30kg. So I want the macro to take data from stream 1 and find the price where its between weight(min) and weight(max) in our price agreement?
Based on your description I think an iterative macro might be overengineering this. Unless I'm missing something, why not just join up the data and use a filter tool to filter the records where the calcweight is less than the weight(max) and greater than the weight(min)?
Can you explain what your macro is supposed to do? If you are looking for if a value is within a range there are better ways to find it than to use an iterative macro. much better ways. An iterative macro is best thought of as Alteryx's version of recursion - and it's best used when the underlying data is going to change between runs. Ie values are being popped out of a queue/discarded. It's best with fewer fields and really clear rules. I find it easier to jettison almost everything except a recordid and whatever fields I need specifically for the macro.
This is the filter tool in your batch macro and I'm not sure it's what you want..
if [CalcWeightPurchase] = 0 THEN
[CalcWeightPurchase]>=[WeightFrom(excl)] AND [CalcWeightPurchase]<= [WeightTo(Incl)]
ELSE [CalcWeightPurchase]>=[WeightFrom(excl)] AND [CalcWeightPurchase]<= [WeightTo(Incl)] ENDIF
Also your macro will stop running once the exit target whether number of iterations or filter is engaged... Also you are joining your data in the workflow and then rejoining in the macro which you don't need to do.
We have different weight bands depending on what product im validating. So the main purpose is to validate the weight - in the range stated in the price agreement without having to define different formulas.
So lets say a package weighs 1 kilo.
And our weight band is like this: 0-1
and so on.
And I do: calcweight > weightfrom and
calcweight <= weightTo and
Then it generated 5 rows, where I can filter out the one I need.
The 4 others filtered out by the filter. So all is good.
But if I have a package that weighs 11 kilo its also filtered out, and ends in the same stream and those?
ive attached some sample data, I hope it makes sense?
My strategy would be to create a row for each weight covered by a range in your weight range spreadsheet - therefore 0-30 for example would have 30 ranges. I can then match this with your weight primary key (billable? calculated?) in your workflow. NOTE. rows which don't exactly match your other criteria will not be joined. They'll be on the right anchor. Perhaps some of these are bulk rates or fall under other categories? You can re-union them back.