locked
Batching RRS feed

  • Question

  • Hello,

    I have a need to do type of batching that I've not been able to find.  I'd like to loop (batch)
    across a set of name/value pairs and only act on them after all of them have been evaluated.
    Plus, the number of pairs is not known until execution time.

    Here is an example of the name/value pairs, showing 3 pairs.  But there could be any number of pairs.
        <ItemGroup>
          <Property Include="1">
            <Name>mary</Name>
            <Value>1</Value>
          </Property>
          <Property Include="2">
            <Name>fred</Name>
            <Value>2</Value>
          </Property>
          <Property Include="3">
            <Name>bill</Name>
            <Value>3</Value>
          </Property>
     ... there is an unknown number of these <Property> inputs
        </ItemGroup>


    I would like to batch across the above ItemGroup and create a result like the following:
       Command Name1=value1 Name2=Value2 Name3=Value3 ... NameX=ValueX

    The results I'm getting are
       Command Name1=value1
       Command Name2=Value2
       Command Name3=Value3

    All of the batching options I have seen involve essentially an execution at the end of each
    batch loop.  What I need is to accumulate the batch results and execute only once, after the final
    batch evaluation.

    Is this possible?

    Thanks


    Curt Zarger curtis.zarger@asmr.com

    Monday, December 15, 2014 8:03 PM

Answers

  •   <Target Name="Build">
        <Message Importance="high" Text="@(Property->'%(Name)=%(Value)', ' ')" />
      </Target>
    

    output: mary=1 fred=2 bill=3

    • Proposed as answer by Anna Cc Tuesday, December 16, 2014 6:09 AM
    • Marked as answer by Curt Zarger Tuesday, December 16, 2014 4:00 PM
    Tuesday, December 16, 2014 4:02 AM

All replies

  • Hi Curt Zarger,

    Could you please provide us with a total sample script to describe your problem? I didn't see any loop in your script. Why you don't like the result like:

    "  Command Name1=value1
       Command Name2=Value2
       Command Name3=Value3"?

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 16, 2014 2:07 AM
  •   <Target Name="Build">
        <Message Importance="high" Text="@(Property->'%(Name)=%(Value)', ' ')" />
      </Target>
    

    output: mary=1 fred=2 bill=3

    • Proposed as answer by Anna Cc Tuesday, December 16, 2014 6:09 AM
    • Marked as answer by Curt Zarger Tuesday, December 16, 2014 4:00 PM
    Tuesday, December 16, 2014 4:02 AM
  • THX!  That was the answer I needed. .... Unfortunately, that has lead me to some additional issues. :-)


    Curt Zarger curtis.zarger@asmr.com

    Tuesday, December 16, 2014 3:59 PM