@manfred-b-0 Zeig mal Deine Struktur:
Welchen Alexa2-Datenpunkt willst du auswerten?
Es müsste auch so aussehen:
[{"Ansage":"wie spät","Datum":"2021.03.14 23:35:45.597"},
Du hast die zweite Variante vom Script genommen?
Bei der objectID muss natürlich eine ID drin stehen, die auch in der SQL-DB geloggt wird.
Kleine Änderung im Script
Blockly mit Sortierung auf ts angepasst
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="q~ac{(!+2+B-%n~wYDs2">objectID</variable>
<variable id="DOu/nF#=)KX2DU:c-De-">AnzahlZeilen</variable>
<variable id="_,J?Uae!8#H-2vsAkD4b">ansage</variable>
<variable id="(gy6#O`miF#|EHDa5?*t">datum</variable>
<variable id="vPT@!irR44$Xfl1}J2Nc">SQLjson</variable>
<variable type="timeout" id="timeout">timeout</variable>
<variable id="J[wf7@CL#BH@pJ5-yw{?">i</variable>
<variable id="*n,/hU7V/77;p4zXp3N@">ergebnis</variable>
</variables>
<block type="procedures_defcustomnoreturn" id="?Z_!YCXcAb{^x,)}_7sM" x="-487" y="-488">
<mutation statements="false">
<arg name="objectID" varid="q~ac{(!+2+B-%n~wYDs2"></arg>
<arg name="AnzahlZeilen" varid="DOu/nF#=)KX2DU:c-De-"></arg>
</mutation>
<field name="NAME">SQl auslesen</field>
<field name="SCRIPT">dmFyIHNxbElEOw0Kc2VuZFRvKCdzcWwuMCcsICdxdWVyeScsICdTRUxFQ1QgKiBGUk9NIGlvYnJva2VyLmRhdGFwb2ludHMgd2hlcmUgbmFtZT0iJysgb2JqZWN0SUQgKyAnIjsnLCBmdW5jdGlvbiAocmVzdWx0KSB7DQogICAgaWYgKHJlc3VsdC5lcnJvcikgew0KICAgICAgICBjb25zb2xlLmVycm9yKHJlc3VsdC5lcnJvcik7DQogICAgICAgIGVyZ2VibmlzPSByZXN1bHQuZXJyb3I7DQogICAgfSBlbHNlIHsNCiAgICAgICAgLy8gc2hvdyByZXN1bHQNCiAgICAgICAgLy9jb25zb2xlLmxvZyhyZ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H0NCiAgICB9KTsNCg0KfSwgMTAwMCk7DQo=</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
</block>
<block type="procedures_defcustomreturn" id="g^I0Vr3xQM/P{,5ZcQm!" x="-487" y="-438">
<mutation statements="false">
<arg name="ansage" varid="_,J?Uae!8#H-2vsAkD4b"></arg>
<arg name="datum" varid="(gy6#O`miF#|EHDa5?*t"></arg>
</mutation>
<field name="NAME">JSONElement erstellen</field>
<field name="SCRIPT">dmFyIHggPSB7fTsNCnguQW5zYWdlID0gYW5zYWdlOw0KeC5EYXR1bSA9IGRhdHVtOw0KeC5wdXNoOw0KcmV0dXJuIHg7</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
</block>
<block type="create" id="e+*n@~gq.-B~ZBix(qs9" x="-488" y="-413">
<field name="NAME">0_userdata.0.sql.ansageJson</field>
<next>
<block type="variables_set" id="`2m[ti.^#FF@x5*K,gN`">
<field name="VAR" id="vPT@!irR44$Xfl1}J2Nc">SQLjson</field>
<value name="VALUE">
<block type="lists_create_with" id="4ZB$`*i]6(Dz=4qi1Zwn">
<mutation items="0"></mutation>
</block>
</value>
<next>
<block type="procedures_callcustomnoreturn" id="V-tuT$0m[#(5?bKf%_UP">
<mutation name="SQl auslesen">
<arg name="objectID"></arg>
<arg name="AnzahlZeilen"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="|7[yx-Xf`BuZSB`JGu`n">
<field name="TEXT">alexa2.0.History.summary</field>
</block>
</value>
<value name="ARG1">
<block type="math_number" id="7Gz7HuDMNq#*iNCoe+a~">
<field name="NUM">10</field>
</block>
</value>
<next>
<block type="comment" id="G.,q-`[QKX#V5-L;W@Ws">
<field name="COMMENT">Zeit evtl. abhängig von DB-Größe</field>
<next>
<block type="timeouts_settimeout" id="bCe*G%JM_VGu-R}*zJ%=">
<field name="NAME">timeout</field>
<field name="DELAY">2000</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="debug" id="tOI?bh?]bd)xwPD0XJ66">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="xpVQp30QORrs}B_yc?5;">
<field name="TEXT">test</field>
</shadow>
<block type="lists_length" id="GKHwEO$IC[t[{:eB*kV~">
<value name="VALUE">
<block type="variables_get" id="m|z6UlFCMt|3l=u{EB0l">
<field name="VAR" id="*n,/hU7V/77;p4zXp3N@">ergebnis</field>
</block>
</value>
</block>
</value>
<next>
<block type="controls_forEach" id="N#/hRB)J5mVjLb=-0TLk">
<field name="VAR" id="J[wf7@CL#BH@pJ5-yw{?">i</field>
<value name="LIST">
<block type="variables_get" id="s@!cq-~YB-bL#}9p;0.8">
<field name="VAR" id="*n,/hU7V/77;p4zXp3N@">ergebnis</field>
</block>
</value>
<statement name="DO">
<block type="debug" id="p03$;8nF1}zuj.FayZ$(" collapsed="true" disabled="true">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="ElT4S/$l@(O2_+f3inuS">
<field name="TEXT">test</field>
</shadow>
<block type="convert_from_date" id="(hogFOsUSdK|56HJ,@5!">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation>
<field name="OPTION">custom</field>
<field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field>
<value name="VALUE">
<block type="convert_jsonata" id="RFvK/LqjG+HPgxWVJJBD">
<value name="EXPRESSION">
<shadow type="text" id="w.vs7[9wF$!,2D;wMY=g">
<field name="TEXT">ts</field>
</shadow>
</value>
<value name="TARGET">
<block type="variables_get" id="znAgj|bUW]BzA)8L;{?_">
<field name="VAR" id="J[wf7@CL#BH@pJ5-yw{?">i</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="debug" id="%F5QMeqs5@A!}rDlCAR}" collapsed="true" disabled="true">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="70`P[FK:wtOusPz45Mlt">
<field name="TEXT">test</field>
</shadow>
<block type="convert_jsonata" id="Jo%;5GVrLx=Bv#LCv?CQ">
<value name="EXPRESSION">
<shadow type="text" id="xh)z5qur=[v?ZTajm*m{">
<field name="TEXT">val</field>
</shadow>
</value>
<value name="TARGET">
<block type="variables_get" id="|g4%z#7!$dnJc$mCU~yC">
<field name="VAR" id="J[wf7@CL#BH@pJ5-yw{?">i</field>
</block>
</value>
</block>
</value>
<next>
<block type="controls_if" id="gzaZ/d[OE04.NP:Z~$4y">
<value name="IF0">
<block type="logic_compare" id="Cj/=`ZUk|O*}as}O97Xc">
<field name="OP">NEQ</field>
<value name="A">
<block type="convert_jsonata" id="jV,/pLL^F{7KB]@GQp6f">
<value name="EXPRESSION">
<shadow type="text" id="B3)!Ht(l_t:O7:D:l2J9">
<field name="TEXT">val</field>
</shadow>
</value>
<value name="TARGET">
<block type="variables_get" id="7Lh+^3wagb+B%h^NEU@z">
<field name="VAR" id="J[wf7@CL#BH@pJ5-yw{?">i</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="text" id="yTO3Ay;i@]Z`v~G=rYb=">
<field name="TEXT"></field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="lists_setIndex" id="mcA=x#ZSCbHH6iJ1uk*,">
<mutation at="false"></mutation>
<field name="MODE">INSERT</field>
<field name="WHERE">LAST</field>
<value name="LIST">
<block type="variables_get" id="@=ncR!H2Gbe(gM:*R-7g">
<field name="VAR" id="vPT@!irR44$Xfl1}J2Nc">SQLjson</field>
</block>
</value>
<value name="TO">
<block type="procedures_callcustomreturn" id="R;xAtWmjf.Am1e*2]Y:Q">
<mutation name="JSONElement erstellen">
<arg name="ansage"></arg>
<arg name="datum"></arg>
</mutation>
<value name="ARG0">
<block type="convert_jsonata" id="06axz;6x0(BhbAQ-[%36">
<value name="EXPRESSION">
<shadow type="text" id="u#@]tWLo(@xCbkBha:?H">
<field name="TEXT">val</field>
</shadow>
</value>
<value name="TARGET">
<block type="variables_get" id=":#n5;CmA,oHq#R5,KY2c">
<field name="VAR" id="J[wf7@CL#BH@pJ5-yw{?">i</field>
</block>
</value>
</block>
</value>
<value name="ARG1">
<block type="convert_from_date" id="gV5%[$~N4F2wU;$]]m@H">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation>
<field name="OPTION">custom</field>
<field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field>
<value name="VALUE">
<block type="convert_jsonata" id="!V0]5(B!2|kpjubKjsyK">
<value name="EXPRESSION">
<shadow type="text" id="5^Z41XJ=f9A!{wOvPxmp">
<field name="TEXT">ts</field>
</shadow>
</value>
<value name="TARGET">
<block type="variables_get" id="{-t6ty,BBYPKh[t?)2Uq">
<field name="VAR" id="J[wf7@CL#BH@pJ5-yw{?">i</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="debug" id="2=B(TR5=TN[.HXc!fD!r" collapsed="true" disabled="true">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="]~}ES(JMgYYs30I{rRz~">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="WoOc[FH1)M(#yWv005:c">
<field name="VAR" id="vPT@!irR44$Xfl1}J2Nc">SQLjson</field>
</block>
</value>
<next>
<block type="control" id="GWc|jL{Cpk@Ik}q4kxo1">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">0_userdata.0.sql.ansageJson</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="convert_object2json" id="*Ieastj2WOQw6?5=VQ_+">
<field name="PRETTIFY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="+Wk|`d(s87IQF2C|daUP">
<field name="VAR" id="vPT@!irR44$Xfl1}J2Nc">SQLjson</field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</xml>
Nur das id auf ts geändert: