login button

Data Services - "Element" works but "Attribute" does not

Forums :

Hi,

I created a Data Service using a CSV file. The following code does not work:

<data name="WeatherService">

<config>

<property name="csv_datasource">/usr/local/mashup/dataservices/weather.csv</property>

<property name="csv_columnseperator">,</property>

<property name="csv_columns">City,Weather</property>

<property name="csv_columnordinal">1,2</property>

<property name="csv_startingrow">1</property>

<property name="csv_maxrowcount">10</property>

<property name="csv_hasheader">true</property>

</config>
<query id="listWeatherQry">
<result element="weatherlist" rowName="weatheritem">
<attribute name="city" column="1" />
<attribute name="weather" column="2" />
</result>
</query>
<operation name="listWeather">
<call-query href="listWeatherQry" />
</operation>

</data>

But the following code works (uses "Element" instead of "Attribute"):

<data name="WeatherService">

<config>

<property name="csv_datasource">/usr/local/mashup/dataservices/weather.csv</property>

<property name="csv_columnseperator">,</property>

<property name="csv_columns">City,Weather</property>

<property name="csv_columnordinal">1,2</property>

<property name="csv_startingrow">1</property>

<property name="csv_maxrowcount">10</property>

<property name="csv_hasheader">true</property>

</config>
<query id="listWeatherQry">
<result element="weatherlist" rowName="weatheritem">
<element name="city" column="1" />
<element name="weather" column="2" />
</result>
</query>
<operation name="listWeather">
<call-query href="listWeatherQry" />
</operation>

</data>

What could be wrong?

Regards,

Ganesh Prasad

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

hi Ganesh, Data Service

hi Ganesh,

Data Service release that comes with WSAS 2.2 does not support formatting results as attributes for CSV & Excel types. I will fix this & make a patch available to you along with instructions on how to apply it.

Thanks,

/sumedha

One more minor nit

Thanks, Sumedha.

One minor point: csv_columnseperator should be spelt cvs_columnseparator (with an 'a' instead of an 'e').

Regards,

Ganesh

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.