Use this board to ask questions or have discussions with other Profound.js users.
ndeppe
New User
Posts: 14 Joined: Fri Dec 05, 2014 1:17 pm
First Name: Nick
Last Name: Deppe
Company Name: Victaulic
Phone: 6109233257
Address 1: 4901 Kesslersville Road
City: Easton
State / Province: Pennsylvania
Zip / Postal Code: 18040
Country: United States
Contact:
Post
by ndeppe » Wed Nov 08, 2017 12:35 pm
I have just started dabbling with Profound.js, and I'm getting stuck with referencing field names. I have a field name called CUST# on a display. How can I reference that field in Javascript?
Here is the code that I have so far:
Code: Select all
function testdisplay() {
pjs.defineDisplay( "display", "test/mytest.json" );
pjs.define( "searchDS", { type: 'ds', likeRec: {record: 'searchwin', fields: '*all' } } );
while (!searchDS.sexit) {
display.searchwin.execute( pjs.ds("searchDS") );
if ( searchDS.cust# != 0 ) { // Ain't gonna work - # isn't allowed in variable names in JavaScript
// DO SOMETHING
}
}
}
exports.run = testdisplay;
ndeppe
New User
Posts: 14 Joined: Fri Dec 05, 2014 1:17 pm
First Name: Nick
Last Name: Deppe
Company Name: Victaulic
Phone: 6109233257
Address 1: 4901 Kesslersville Road
City: Easton
State / Province: Pennsylvania
Zip / Postal Code: 18040
Country: United States
Contact:
Post
by ndeppe » Wed Nov 08, 2017 2:07 pm
OK, I found the answer to my own question. The fields can be accessed as an associative array, as below.
Code: Select all
function testdisplay() {
pjs.defineDisplay( "display", "test/mytest.json" );
pjs.define( "searchDS", { type: 'ds', likeRec: {record: 'searchwin', fields: '*all' } } );
while (!searchDS.sexit) {
display.searchwin.execute( pjs.ds("searchDS") );
if ( searchDS['cust#'] != 0 ) { // gonna work
// DO SOMETHING
}
}
}
Users browsing this forum: Bing [Bot] and 2 guests