Hi everyone,
Please help me in using "Generate Attribute" for extracting values from a json response from a URL. I am retrieving json resonse from a URL which has date wise value starting from "2017-01-01". I need to extract latest value (previous day value).
I have a macro for replacing the "day of the year" in json querry. I inserted the macro in the JSON query, but its giving error.
The query : [timeline\[eval(%{no_Of_Days})\].station_values\[0\].value]
The XML of the process is :
<?xml version="1.0" encoding="UTF-8"?><process version="7.5.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.5.001" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="generate_macro" compatibility="7.5.001" expanded="true" height="82" name="Generate Macro" width="90" x="179" y="34">
<list key="function_descriptions">
<parameter key="m_no_Of_Days" value="floor(date_diff(date_parse_custom("2017-01-01","yyyy-MM-dd"),date_parse_custom(date_str_custom(date_now(),"yyyy-MM-dd"),"yyyy-MM-dd"))/86400000)"/>
<parameter key="m_endDate" value="date_str_custom(date_add(date_now(), -1, DATE_UNIT_DAY), "MM%2Fdd%2FYYYY")"/>
<parameter key="no_Of_Days" value="284"/>
</list>
</operator>
<operator activated="true" class="web:get_webpage" compatibility="7.3.000" expanded="true" height="68" name="TV Mentions" width="90" x="179" y="136">
<parameter key="url" value="http://television.gdeltproject.org/cgi-bin/iatv_ftxtsearch/iatv_ftxtsearch?primary_keyword=Gillespie%2C+ed&context_keywords=&filter_network=NATIONAL&filter_timespan=CUSTOM&filter_timespan_custom_start=01%2F01%2F2017&filter_timespan_custom_end=%{m_endDate}&filter_displayas=RAW&filter_combineseparate=COMBINE&filter_outputtype=JSON#searchbox "/>
<parameter key="accept_cookies" value="all"/>
<list key="query_parameters"/>
<list key="request_properties"/>
</operator>
<operator activated="true" class="delay" compatibility="7.5.001" expanded="true" height="103" name="Delay" width="90" x="447" y="34"/>
<operator activated="true" class="text:json_to_data" compatibility="7.5.000" expanded="true" height="82" name="JSON To Data (2)" width="90" x="648" y="34"/>
<operator activated="true" class="generate_attributes" compatibility="7.5.001" expanded="true" height="82" name="Generate Attributes" width="90" x="849" y="34">
<list key="function_descriptions">
<parameter key="value" value="[timeline\[eval(%{no_Of_Days})\].station_values\[0\].value]"/>
</list>
</operator>
<connect from_port="input 1" to_op="Generate Macro" to_port="through 1"/>
<connect from_op="Generate Macro" from_port="through 1" to_op="Delay" to_port="through 1"/>
<connect from_op="TV Mentions" from_port="output" to_op="Delay" to_port="through 2"/>
<connect from_op="Delay" from_port="through 1" to_op="JSON To Data (2)" to_port="documents 1"/>
<connect from_op="JSON To Data (2)" from_port="example set" to_op="Generate Attributes" to_port="example set input"/>
<connect from_op="Generate Attributes" from_port="example set output" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="source_input 2" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>