<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: cannot read data via javascript / data node is empty in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cannot-read-data-via-javascript-data-node-is-empty/qaa-p/5587214#M2075813</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;solution in Javascript&lt;/P&gt;&lt;P&gt;if you want to access the value of a field you can use two (perhps more?) ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Via the DATA node --&amp;gt; var myVar = xfa.resolveNode("xfa.record.MY_FIELD").rawValue or .value, depends on your type&lt;/P&gt;&lt;P&gt;Via the hierarchy node --&amp;gt;&lt;/P&gt;&lt;P&gt;var myVar = xfa.resolveNode("data.Page1.subform1.MY_FIELD").rawValue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can try this: if your cursor is positioned in the script editor for example after "var myVar = " hold the control (="Strg"?) button on your panel an go with the cursor to the relevant field --&amp;gt; a "V" will appear --&amp;gt; now do a left mouse click and the correct SOM expression will be copied to your script. You will just have to add "rawValue" or "Value"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for tables it's a little bit different...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tell me if it worked, please&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;br&lt;/P&gt;&lt;P&gt;norbert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 May 2009 11:28:47 GMT</pubDate>
    <dc:creator>NoJo</dc:creator>
    <dc:date>2009-05-12T11:28:47Z</dc:date>
    <item>
      <title>cannot read data via javascript / data node is empty</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-read-data-via-javascript-data-node-is-empty/qaq-p/5587212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i try to create a print form with Adobe Forms. The job is nearly done, but now i have to do following:&lt;/P&gt;&lt;P&gt;Depending on some data (which is not bound via data binding) i'd like to do some formatting (background color, font ...).&lt;/P&gt;&lt;P&gt;For this purpose i have inserted a javascript to the initialize-event:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this.rawValue = xfa.resolveNode("xfa.datasets.data.MY_FIELD").value;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i get no data. The MY_FIELD node is not found.&lt;/P&gt;&lt;P&gt;After trying resolveNode with various paths, i tried&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this.rawValue = xfa.resolveNode("xfa.datasets.data").saveXML();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:dataNode="dataGroup" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data node is empty. But why???&lt;/P&gt;&lt;P&gt;Data binding works. The data is passed to the form completely. I just cannot read it via script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't want to use data binding with invisible fields and then read the field values, because i need this also in a table. Using invisible fields in table is not a good idea, because you cannot make table cells invisible without getting "holes" in your table &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help appreciated!&lt;/P&gt;&lt;P&gt;Peter Herweg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 08:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-read-data-via-javascript-data-node-is-empty/qaq-p/5587212</guid>
      <dc:creator>former_member356497</dc:creator>
      <dc:date>2009-05-07T08:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: cannot read data via javascript / data node is empty</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-read-data-via-javascript-data-node-is-empty/qaa-p/5587213#M2075812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i found the solution by myself.&lt;/P&gt;&lt;P&gt;This is my script placed into the initialize-event of a table-row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
function pad(t, count) {
	var s = new String(t);
	while ( s.length &amp;lt;  count) {
	  s = '0' + s ;
	}
	
	return s;
}

for(var z=1;z&amp;lt;=31;++z) {
	var sDay = pad(z,2);

	var s    = "$record.TABLEDATA.DATA[" + this.index + "].DAYS.VALUE" + sDay;
	var oDay = this.resolveNode(s);

	if (oDay.HOLIDAY.value == "X"
	|| oDay.WEEKDAY_S.value == "SA"
	|| oDay.WEEKDAY_S.value == "SO") {
		this.resolveNode("SHORTSVALUE" + sDay).fillColor = "255,100,100";
	}
}
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem was the SOM expression which is passed to resolveNode. I have a book which tells me to begin the SOM expression with xfa.datasets.data in order to access the data nodes. Obviously this is wrong &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;  You have to start with $record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Peter Herweg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Peter Herweg on May 8, 2009 3:20 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Peter Herweg on May 8, 2009 3:21 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Peter Herweg on May 8, 2009 3:22 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 13:20:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-read-data-via-javascript-data-node-is-empty/qaa-p/5587213#M2075812</guid>
      <dc:creator>former_member356497</dc:creator>
      <dc:date>2009-05-08T13:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: cannot read data via javascript / data node is empty</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-read-data-via-javascript-data-node-is-empty/qaa-p/5587214#M2075813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;solution in Javascript&lt;/P&gt;&lt;P&gt;if you want to access the value of a field you can use two (perhps more?) ways.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Via the DATA node --&amp;gt; var myVar = xfa.resolveNode("xfa.record.MY_FIELD").rawValue or .value, depends on your type&lt;/P&gt;&lt;P&gt;Via the hierarchy node --&amp;gt;&lt;/P&gt;&lt;P&gt;var myVar = xfa.resolveNode("data.Page1.subform1.MY_FIELD").rawValue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can try this: if your cursor is positioned in the script editor for example after "var myVar = " hold the control (="Strg"?) button on your panel an go with the cursor to the relevant field --&amp;gt; a "V" will appear --&amp;gt; now do a left mouse click and the correct SOM expression will be copied to your script. You will just have to add "rawValue" or "Value"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for tables it's a little bit different...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tell me if it worked, please&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;br&lt;/P&gt;&lt;P&gt;norbert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2009 11:28:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-read-data-via-javascript-data-node-is-empty/qaa-p/5587214#M2075813</guid>
      <dc:creator>NoJo</dc:creator>
      <dc:date>2009-05-12T11:28:47Z</dc:date>
    </item>
  </channel>
</rss>

