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!
The Product Idea boards have gotten an update to better integrate them within our Product team's idea cycle! However this update does have a few unique behaviors, if you have any questions about them check out our FAQ.

Alteryx Designer Desktop Ideas

Share your Designer Desktop product ideas - we're listening!
Submitting an Idea?

Be sure to review our Idea Submission Guidelines for more information!

Submission Guidelines

Maximum Number of Iterations should be automatically calculated

Dear Alteryx,

Alteryx 9 new Macro configuration module, is great
One thing that could be improved :

For Iterative macros, it's very frustrated to set a Maximum of Iterations manually :
when the number is too high it keeps going unnecessarily
when it's too low, we are missing iterations

Ideally this parameters should be calculated automatically by Alteryx
It would just implie to have the possibility to declare the numeric field that must be used for Iteration ... then Alteryx could calculate before launching the job, the Min/Max to set automatically the iteration band.

Is this idea stupid?

Thanks

Arno
4 Comments
BenG
Alteryx Alumni (Retired)

Hi Arno,

Iterative macros are tricky.  The best way to handle the number of iterations is to adjust the end conditions for the macro.  Ideally, the macro would not reach the maximum number of iterations.  I would imagine that if you have something like an iterative macro that is trying to get a solution to converge on a specific answer, and the data set isn't converging, that is when a max number of iterations should come into play.  Every macro will have a different idea of how many iterations is correct for that macro.

Thanks,

Ben

stubartmess
6 - Meteoroid

Hi Arnaud,

 

I've worked around this a bit by setting two outputs in the iteration file, with a filter separating the two.

If the macro needs to iterate again, the filter moves all the data to the designated Iteration Output, but if the iterations are complete the filter pushes all the data to the second output.

 

If you set iterations to 1000000 but only need 6, the macro runs the last 999994 iterations on an empty dataset, which takes no time at all. 

 

Capture.PNG

 

 

Spower
6 - Meteoroid

Hi 

 

 

stubartmess
6 - Meteoroid

@Spower

 

I can't for the life of me find the attachment button, so I've just pasted the raw XML at the bottom. If you save this in notepad as ExampleIterator.yxmc you should be able to open it in Alteryx.

 

This key points are that if you stop feeding data to your designated iterative output, the macro will stop iterating. If you pass data to another output, it will pass the data from every single pass through the macro (appending to the end each time). Using a filter to indicate when the iterations should finish will let you both end the iterations at the correct time, and pass only your final information to the alternative output.

 

In the photo below, data will keep passing through the iterative macro until the test >= 10, after which point the loop is broken and data is passed to the final output.

If you run this macro from another workflow, the first output will appear to give no data, the second output will give a single row showing test=10, and the third row will show 9 rows with test=2,3,4,5...10.

 

IterativeExample.PNG

 

Hope this helps!

Stu

 

<?xml version="1.0"?>
<AlteryxDocument yxmdVer="2018.1">
  <Nodes>
    <Node ToolID="1">
      <GuiSettings Plugin="AlteryxGuiToolkit.Questions.Tab.Tab">
        <Position x="0" y="0" width="59" height="59" />
      </GuiSettings>
      <Properties>
        <Annotation DisplayMode="0">
          <Name />
          <DefaultAnnotationText />
          <Left value="False" />
        </Annotation>
      </Properties>
    </Node>
    <Node ToolID="2">
      <GuiSettings Plugin="AlteryxBasePluginsGui.MacroInput.MacroInput">
        <Position x="198" y="150" />
      </GuiSettings>
      <Properties>
        <Configuration>
          <UseFileInput value="False" />
          <Name>Input2</Name>
          <Abbrev />
          <ShowFieldMap value="True" />
          <Optional value="False" />
          <TextInput>
            <Configuration>
              <NumRows value="1" />
              <Fields>
                <Field name="test" />
              </Fields>
              <Data>
                <r>
                  <c>1</c>
                </r>
              </Data>
            </Configuration>
          </TextInput>
        </Configuration>
        <Annotation DisplayMode="0">
          <Name />
          <DefaultAnnotationText />
          <Left value="True" />
        </Annotation>
        <MetaInfo connection="Output">
          <RecordInfo>
            <Field name="test" source="TextInput:" type="Byte" />
          </RecordInfo>
        </MetaInfo>
      </Properties>
      <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxMacroInput" />
    </Node>
    <Node ToolID="3">
      <GuiSettings Plugin="AlteryxBasePluginsGui.Formula.Formula">
        <Position x="282" y="150" />
      </GuiSettings>
      <Properties>
        <Configuration>
          <FormulaFields>
            <FormulaField expression="test+1" field="test" size="1" type="Byte" />
          </FormulaFields>
        </Configuration>
        <Annotation DisplayMode="0">
          <Name />
          <DefaultAnnotationText><![CDATA[test = test+1
]]></DefaultAnnotationText>
          <Left value="False" />
        </Annotation>
        <MetaInfo connection="Output">
          <RecordInfo>
            <Field name="test" source="Formula: test+1" type="Byte" />
          </RecordInfo>
        </MetaInfo>
      </Properties>
      <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxFormula" />
    </Node>
    <Node ToolID="4">
      <GuiSettings Plugin="AlteryxBasePluginsGui.Filter.Filter">
        <Position x="390" y="150" />
      </GuiSettings>
      <Properties>
        <Configuration>
          <Expression>[test] &lt; 10</Expression>
          <Mode>Simple</Mode>
          <Simple>
            <Operator>&lt;</Operator>
            <Field>test</Field>
            <Operands>
              <IgnoreTimeInDateTime>True</IgnoreTimeInDateTime>
              <DateType>fixed</DateType>
              <PeriodDate>2018-07-16 10:37:31</PeriodDate>
              <PeriodType>
              </PeriodType>
              <PeriodCount>0</PeriodCount>
              <StartDate>2018-07-16 10:37:31</StartDate>
              <EndDate>2018-07-16 10:37:31</EndDate>
              <Operand>10</Operand>
            </Operands>
          </Simple>
        </Configuration>
        <Annotation DisplayMode="0">
          <Name />
          <DefaultAnnotationText>[test] &lt; 10</DefaultAnnotationText>
          <Left value="False" />
        </Annotation>
        <MetaInfo connection="True">
          <RecordInfo>
            <Field name="test" source="Formula: test+1" type="Byte" />
          </RecordInfo>
        </MetaInfo>
        <MetaInfo connection="False">
          <RecordInfo>
            <Field name="test" source="Formula: test+1" type="Byte" />
          </RecordInfo>
        </MetaInfo>
      </Properties>
      <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxFilter" />
    </Node>
    <Node ToolID="5">
      <GuiSettings Plugin="AlteryxBasePluginsGui.MacroOutput.MacroOutput">
        <Position x="522" y="90" />
      </GuiSettings>
      <Properties>
        <Configuration>
          <Name>Iterative Output</Name>
          <Abbrev />
        </Configuration>
        <Annotation DisplayMode="0">
          <Name />
          <AnnotationText>Iterative output</AnnotationText>
          <DefaultAnnotationText />
          <Left value="False" />
        </Annotation>
      </Properties>
      <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxMacroOutput" />
    </Node>
    <Node ToolID="6">
      <GuiSettings Plugin="AlteryxBasePluginsGui.MacroOutput.MacroOutput">
        <Position x="522" y="186" />
      </GuiSettings>
      <Properties>
        <Configuration>
          <Name>Final Output</Name>
          <Abbrev />
        </Configuration>
        <Annotation DisplayMode="0">
          <Name />
          <AnnotationText>Final output</AnnotationText>
          <DefaultAnnotationText />
          <Left value="False" />
        </Annotation>
      </Properties>
      <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxMacroOutput" />
    </Node>
    <Node ToolID="7">
      <GuiSettings Plugin="AlteryxBasePluginsGui.MacroOutput.MacroOutput">
        <Position x="522" y="294" />
      </GuiSettings>
      <Properties>
        <Configuration>
          <Name>Output7</Name>
          <Abbrev />
        </Configuration>
        <Annotation DisplayMode="0">
          <Name />
          <AnnotationText>Incremental output</AnnotationText>
          <DefaultAnnotationText />
          <Left value="False" />
        </Annotation>
      </Properties>
      <EngineSettings EngineDll="AlteryxBasePluginsEngine.dll" EngineDllEntryPoint="AlteryxMacroOutput" />
    </Node>
  </Nodes>
  <Connections>
    <Connection>
      <Origin ToolID="2" Connection="Output" />
      <Destination ToolID="3" Connection="Input" />
    </Connection>
    <Connection>
      <Origin ToolID="3" Connection="Output" />
      <Destination ToolID="4" Connection="Input" />
    </Connection>
    <Connection>
      <Origin ToolID="3" Connection="Output" />
      <Destination ToolID="7" Connection="Input" />
    </Connection>
    <Connection>
      <Origin ToolID="4" Connection="True" />
      <Destination ToolID="5" Connection="Input" />
    </Connection>
    <Connection>
      <Origin ToolID="4" Connection="False" />
      <Destination ToolID="6" Connection="Input" />
    </Connection>
  </Connections>
  <Properties>
    <Memory default="True" />
    <GlobalRecordLimit value="0" />
    <TempFiles default="True" />
    <Annotation on="True" includeToolName="False" />
    <ConvErrorLimit value="10" />
    <ConvErrorLimit_Stop value="False" />
    <CancelOnError value="False" />
    <DisableBrowse value="False" />
    <EnablePerformanceProfiling value="False" />
    <DisableAllOutput value="False" />
    <ShowAllMacroMessages value="False" />
    <ShowConnectionStatusIsOn value="True" />
    <ShowConnectionStatusOnlyWhenRunning value="True" />
    <ZoomLevel value="0" />
    <LayoutType>Horizontal</LayoutType>
    <Constants>
      <Constant>
        <Namespace>Question</Namespace>
        <Name>Macro Output (7)</Name>
        <Value />
        <IsNumeric value="False" />
      </Constant>
    </Constants>
    <MetaInfo>
      <NameIsFileName value="True" />
      <Name>example_iterator</Name>
      <Description />
      <RootToolName />
      <ToolVersion />
      <ToolInDb value="False" />
      <CategoryName />
      <SearchTags />
      <Author />
      <Company />
      <Copyright />
      <DescriptionLink actual="" displayed="" />
      <Example>
        <Description />
        <File />
      </Example>
    </MetaInfo>
    <Events>
      <Enabled value="False" />
    </Events>
    <RuntimeProperties>
      <Actions />
      <Questions>
        <Question>
          <Type>Tab</Type>
          <Description>Questions</Description>
          <Name>Tab (1)</Name>
          <ToolId value="1" />
          <Questions>
            <Question>
              <Type>MacroInput</Type>
              <Description>Macro Input (2)</Description>
              <Name>Macro Input (2)</Name>
              <ToolId value="2" />
            </Question>
            <Question>
              <Type>MacroOutput</Type>
              <Description>Macro Output (5)</Description>
              <Name>Macro Output (5)</Name>
              <ToolId value="5" />
            </Question>
            <Question>
              <Type>MacroOutput</Type>
              <Description>Macro Output (6)</Description>
              <Name>Macro Output (6)</Name>
              <ToolId value="6" />
            </Question>
            <Question>
              <Type>MacroOutput</Type>
              <Description>Macro Output (7)</Description>
              <Name>Macro Output (7)</Name>
              <ToolId value="7" />
            </Question>
          </Questions>
        </Question>
      </Questions>
      <ModuleType>Macro</ModuleType>
      <MacroCustomHelp value="False" />
      <MacroDynamicOutputFields value="False" />
      <MacroImageStd value="39" />
      <MacroInputs />
      <MacroOutputs />
      <IterativeMacro>
        <Input>Input2</Input>
        <Output>Iterative Output</Output>
        <IterationLimit value="100" />
        <LimitBehavior>Error</LimitBehavior>
        <OutputMode>AllSame</OutputMode>
      </IterativeMacro>
      <Wiz_CustomHelp value="False" />
      <Wiz_CustomGraphic value="False" />
      <Wiz_ShowOutput value="True" />
      <Wiz_OpenOutputTools>
        <Tool ToolId="2" Selected="True" />
        <Tool ToolId="5" Selected="True" />
        <Tool ToolId="6" Selected="True" />
        <Tool ToolId="7" Selected="True" />
      </Wiz_OpenOutputTools>
      <Wiz_OutputMessage />
      <Wiz_NoOutputFilesMessage />
      <Wiz_ChainRunWizard />
    </RuntimeProperties>
  </Properties>
</AlteryxDocument>