<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Get value from CDT array</title><link>https://community.appian.com/discussions/f/process/17295/get-value-from-cdt-array</link><description>I&amp;#39;m facing an issue. 
 I&amp;#39;m calling an API that returns this response: 
 
 I need to get the Power Value when Unit is equal to &amp;quot;HP&amp;quot;. 
 
 I created this expression rule (and many others): 
 
 But when I use it inside a process I get this error: 
 An error</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Get value from CDT array</title><link>https://community.appian.com/thread/68189?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2019 07:23:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5343f63c-b2b1-44d6-aeb0-f511b1dd806f</guid><dc:creator>Thomas Loiseau</dc:creator><description>&lt;p&gt;Still the same error&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;An error occurred while evaluating expression: power:pv!response.eurotaxIdentificationResponse.VehicleList.Vehicle.Engine.Power (Cannot index &amp;quot;Power&amp;quot; because it is an array type (List of PSA_Unit_Value_Type). Only fields with scalar types can be indexed from an array.) (Data Outputs)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I put some screen and info down this post&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get value from CDT array</title><link>https://community.appian.com/thread/68188?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2019 07:18:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2b63f42a-6bee-434b-875e-59bee8809ade</guid><dc:creator>Thomas Loiseau</dc:creator><description>&lt;p&gt;Engine CDT&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/14/pastedimage1563261306274v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Unit_Value CDT&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/14/pastedimage1563261376533v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The API returns this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="json"&gt;{
  &amp;quot;eurotaxIdentificationResponse&amp;quot;: {
    &amp;quot;Settings&amp;quot;: {
      &amp;quot;ISOcountryCode&amp;quot;: &amp;quot;FR&amp;quot;,
      &amp;quot;ISOlanguageCode&amp;quot;: &amp;quot;FR&amp;quot;,
      &amp;quot;ISOcurrencyCode&amp;quot;: &amp;quot;EUR&amp;quot;
    },
    &amp;quot;VehicleList&amp;quot;: {
      &amp;quot;Vehicle&amp;quot;: [
        {
          &amp;quot;VehicleType&amp;quot;: {
            &amp;quot;VehicleTypeCode&amp;quot;: &amp;quot;10&amp;quot;,
            &amp;quot;Name&amp;quot;: &amp;quot;V&amp;#233;hicule particulier&amp;quot;,
            &amp;quot;ShortName&amp;quot;: &amp;quot;VP&amp;quot;
          },
          &amp;quot;Make&amp;quot;: {
            &amp;quot;MakeCode&amp;quot;: &amp;quot;2&amp;quot;,
            &amp;quot;Name&amp;quot;: &amp;quot;PEUGEOT&amp;quot;
          },
          &amp;quot;Model&amp;quot;: {
            &amp;quot;ModelCode&amp;quot;: &amp;quot;6640&amp;quot;,
            &amp;quot;Name&amp;quot;: &amp;quot;308&amp;quot;
          },
          &amp;quot;Type&amp;quot;: {
            &amp;quot;NationalVehicleCode&amp;quot;: &amp;quot;193363&amp;quot;,
            &amp;quot;InternationalVehicleCode&amp;quot;: &amp;quot;10042205023&amp;quot;,
            &amp;quot;Name&amp;quot;: &amp;quot;308 1.6 BlueHDi 120ch S&amp;amp;S BVM6 BC&amp;quot;,
            &amp;quot;TrimLineName&amp;quot;: &amp;quot;Active&amp;quot;,
            &amp;quot;ProductionPeriod&amp;quot;: {
              &amp;quot;ProductionStartDate&amp;quot;: {
                &amp;quot;Month&amp;quot;: &amp;quot;05&amp;quot;,
                &amp;quot;Year&amp;quot;: &amp;quot;2017&amp;quot;
              },
              &amp;quot;ProductionEndDate&amp;quot;: {
                &amp;quot;Month&amp;quot;: &amp;quot;10&amp;quot;,
                &amp;quot;Year&amp;quot;: &amp;quot;2017&amp;quot;
              }
            },
            &amp;quot;NewPrice&amp;quot;: {
              &amp;quot;RequestedLowerBound&amp;quot;: &amp;quot;0.00&amp;quot;,
              &amp;quot;Price&amp;quot;: {
                &amp;quot;Amount&amp;quot;: &amp;quot;26100.00&amp;quot;,
                &amp;quot;ISOcurrencyCode&amp;quot;: &amp;quot;EUR&amp;quot;,
                &amp;quot;AmountDate&amp;quot;: {
                  &amp;quot;Month&amp;quot;: &amp;quot;07&amp;quot;,
                  &amp;quot;Year&amp;quot;: &amp;quot;2017&amp;quot;
                },
                &amp;quot;Indicator&amp;quot;: &amp;quot;0&amp;quot;
              }
            },
            &amp;quot;SortCode&amp;quot;: &amp;quot;3020&amp;quot;
          },
          &amp;quot;MarketSegment&amp;quot;: {
            &amp;quot;MarketSegmentDescription&amp;quot;: {
              &amp;quot;Code&amp;quot;: &amp;quot;30004&amp;quot;,
              &amp;quot;Name&amp;quot;: &amp;quot;M1&amp;quot;
            }
          },
          &amp;quot;Body&amp;quot;: {
            &amp;quot;BodyStyleDescription&amp;quot;: {
              &amp;quot;Code&amp;quot;: &amp;quot;10060&amp;quot;,
              &amp;quot;Name&amp;quot;: &amp;quot;Ber&amp;quot;,
              &amp;quot;NameEx&amp;quot;: &amp;quot;Berline&amp;quot;
            },
            &amp;quot;DoorsNumber&amp;quot;: &amp;quot;5&amp;quot;
          },
          &amp;quot;Transmission&amp;quot;: {
            &amp;quot;DriveType&amp;quot;: {
              &amp;quot;Code&amp;quot;: &amp;quot;50001&amp;quot;,
              &amp;quot;Name&amp;quot;: &amp;quot;TAV&amp;quot;,
              &amp;quot;NameEx&amp;quot;: &amp;quot;Traction avant&amp;quot;
            },
            &amp;quot;GearBox&amp;quot;: {
              &amp;quot;Type&amp;quot;: {
                &amp;quot;Code&amp;quot;: &amp;quot;180001&amp;quot;,
                &amp;quot;Name&amp;quot;: &amp;quot;M&amp;quot;,
                &amp;quot;NameEx&amp;quot;: &amp;quot;Bo&amp;#238;te manuelle&amp;quot;
              },
              &amp;quot;GearsNumber&amp;quot;: &amp;quot;6&amp;quot;
            }
          },
          &amp;quot;Engine&amp;quot;: {
            &amp;quot;Fuel&amp;quot;: {
              &amp;quot;Code&amp;quot;: &amp;quot;100003&amp;quot;,
              &amp;quot;Name&amp;quot;: &amp;quot;D&amp;quot;,
              &amp;quot;NameEx&amp;quot;: &amp;quot;Diesel&amp;quot;
            },
            &amp;quot;Layout&amp;quot;: {
              &amp;quot;Name&amp;quot;: &amp;quot;l&amp;quot;
            },
            &amp;quot;Power&amp;quot;: [
              {
                &amp;quot;Value&amp;quot;: &amp;quot;88.00&amp;quot;,
                &amp;quot;Unit&amp;quot;: &amp;quot;KW&amp;quot;
              },
              {
                &amp;quot;Value&amp;quot;: &amp;quot;120.00&amp;quot;,
                &amp;quot;Unit&amp;quot;: &amp;quot;HP&amp;quot;
              }
            ],
            &amp;quot;Displacement&amp;quot;: {
              &amp;quot;Value&amp;quot;: &amp;quot;1560.00&amp;quot;,
              &amp;quot;Unit&amp;quot;: &amp;quot;ccm&amp;quot;
            },
            &amp;quot;CylindersNumber&amp;quot;: &amp;quot;4&amp;quot;,
            &amp;quot;ValvesPerCylinder&amp;quot;: &amp;quot;2&amp;quot;
          },
          &amp;quot;Miscellaneous&amp;quot;: {
            &amp;quot;TotalWeight&amp;quot;: {
              &amp;quot;Value&amp;quot;: &amp;quot;1810.00&amp;quot;,
              &amp;quot;Unit&amp;quot;: &amp;quot;kg&amp;quot;
            },
            &amp;quot;PayLoad&amp;quot;: {
              &amp;quot;Value&amp;quot;: &amp;quot;625.00&amp;quot;,
              &amp;quot;Unit&amp;quot;: &amp;quot;kg&amp;quot;
            },
            &amp;quot;Wheelbase&amp;quot;: {
              &amp;quot;Value&amp;quot;: &amp;quot;2620.00&amp;quot;,
              &amp;quot;Unit&amp;quot;: &amp;quot;mm&amp;quot;
            },
            &amp;quot;Wheelbase2&amp;quot;: {
              &amp;quot;Value&amp;quot;: &amp;quot;0.00&amp;quot;,
              &amp;quot;Unit&amp;quot;: &amp;quot;mm&amp;quot;
            },
            &amp;quot;SeatsNumber&amp;quot;: &amp;quot;5&amp;quot;,
            &amp;quot;CurbWeight&amp;quot;: {
              &amp;quot;Value&amp;quot;: &amp;quot;1185.00&amp;quot;,
              &amp;quot;Unit&amp;quot;: &amp;quot;kg&amp;quot;
            },
            &amp;quot;ManufacturerProductID&amp;quot;: [
              &amp;quot;1PT9 A5LKD KB0 BM C0&amp;quot;
            ],
            &amp;quot;TaxHorsePower&amp;quot;: {
              &amp;quot;Value&amp;quot;: &amp;quot;5.00&amp;quot;,
              &amp;quot;Unit&amp;quot;: &amp;quot;HP&amp;quot;
            }
          }
        }
      ]
    },
    &amp;quot;status&amp;quot;: &amp;quot;OK&amp;quot;,
    &amp;quot;message&amp;quot;: &amp;quot;success&amp;quot;
  }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I create a lot of type to parse this JSON data. I don&amp;#39;t know if it&amp;#39;s the right way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get value from CDT array</title><link>https://community.appian.com/thread/68186?ContentTypeID=1</link><pubDate>Tue, 16 Jul 2019 04:45:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e3b599fc-8825-42b4-8112-2934cb5a7c81</guid><dc:creator>ankitab0001</dc:creator><description>&lt;p&gt;Hi @thomas&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you try something like this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;load(
  
  local!engine: {
    Fuel: 
        {Code: &amp;quot;100003&amp;quot;,
        Name: &amp;quot;D&amp;quot;,
        NameEx: &amp;quot;Diesel&amp;quot;
        },
    Layout: 
        {Name: &amp;quot;l&amp;quot;},
    Power: {{
            Value: &amp;quot;88.00&amp;quot;,
            Unit: &amp;quot;KW&amp;quot;
            },
            {
            Value: &amp;quot;120.00&amp;quot;,
            Unit: &amp;quot;HP&amp;quot;
            }
            },
    Displacement: {
        Value: &amp;quot;1560.00&amp;quot;,
        Unit: &amp;quot;ccm&amp;quot;
        },
    CylindersNumber: &amp;quot;4&amp;quot;,
    ValvesPerCylinder: &amp;quot;2&amp;quot;
    },
    
    local!power: index(local!engine,&amp;quot;Power&amp;quot;,{}),
    index(index(local!power,&amp;quot;Value&amp;quot;,{}), wherecontains(&amp;quot;HP&amp;quot;,apply(tostring(_),index(local!power,&amp;quot;Unit&amp;quot;,{}))),{})
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get value from CDT array</title><link>https://community.appian.com/thread/68182?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2019 20:21:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f91cc5b0-ff79-4479-860c-45ab0cb1b0ad</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;The error states there&amp;#39;s a vehicleList.&amp;nbsp; The error explicitly states you&amp;#39;re not able to index an array member from an array of CDT.&amp;nbsp; You have to have 2 arrays at minimum in order to generate the error.&lt;/p&gt;
&lt;p&gt;Perhaps it would be best to look at both how you call it in the rule and how you call it in the process model.&lt;/p&gt;
&lt;p&gt;It might be something as simple as accidentally hitting the check box that says a PV is multiple.&amp;nbsp; Even if it is only 1 item in that case, it&amp;#39;s a 1 length list and won&amp;#39;t let you index.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get value from CDT array</title><link>https://community.appian.com/thread/68175?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2019 15:17:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5eb3603e-a987-46dd-a5d1-04e4b27bd797</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Can you post some more information (i.e. a screenshot maybe) of the structure of the &amp;quot;pv!response&amp;quot; data type?&amp;nbsp; Including how it&amp;#39;s nested and what level(s) include array values as opposed to single values.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get value from CDT array</title><link>https://community.appian.com/thread/68172?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2019 13:43:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1ae95baf-6a28-4b0b-b5f7-c6833d91f3f0</guid><dc:creator>Thomas Loiseau</dc:creator><description>&lt;p&gt;I call my expression rule and pass the following data:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Power=[Unit=KW, Value=88.00],[Unit=HP, Value=120.00]&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;from this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Engine=[Fuel=[Code=100003, Name=D, NameEx=Diesel], unbounded=, Displacement=[Unit=ccm, Value=1560.00], ValvesPerCylinder=2, CylindersNumber=4, Power=[Unit=KW, Value=88.00],[Unit=HP, Value=120.00]]&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The purpose of my expression rule is to get the value when the unit is equal to &amp;quot;HP&amp;quot;&lt;/p&gt;
&lt;p&gt;The power is expressed in multiple units but I only need one.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand why you mention that I have multiple car.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get value from CDT array</title><link>https://community.appian.com/thread/68171?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2019 13:35:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6f7ee3ce-92c6-4c09-b9bf-51dcea8fac6a</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;Looking at your error, it&amp;nbsp;appears to be farther upstream.&amp;nbsp; It looks like you haven&amp;#39;t included the entirety of your response.&amp;nbsp; If your response has a&amp;nbsp;Vehicle list, and each in a list of Vehicles has an Engine with a list of&amp;nbsp;Power, you&amp;#39;ve got nested arrays.&amp;nbsp; You can&amp;#39;t index nested arrays all at once.&amp;nbsp; If you had 10 Vehicles, you&amp;#39;d&amp;nbsp; be trying to index 10 sets of 2 Powers.&amp;nbsp; It can do a set of 2, or 10 things, but it can&amp;#39;t do 10 sets of 2 all at once.&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;solution is index all the vehicles one at a time in a larger parent rule with a!forEach.&amp;nbsp; Call a helper rule on each vehicle.&amp;nbsp; To that rule&amp;#39;s perspective, you have only 1 Vehicle (10 times it thinks you only have 1 Vehicle), so you can pull the array of Powers out of just one vehicle.&amp;nbsp; Then you can get the one &amp;quot;HP&amp;quot; based value and have the helper rule return that, which will return one at a time in the larger a!forEach, resulting in a list of HP values.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>