I have entered in the parameters for a query here: Query: Sign (ID: 0)
I return a total of 8 signs in this query, but I want to connect the returned information to a form using previous and next buttons to increment or decrement by one for each button click to assign that specific record to the form and then switch forms once the max or minimum number has been reached.
Just to be safe, my parameters were as follows:
Where: SUPPORTID='691'
Out Fields: *
Order By Fields: OBJECTID
Everything else was the default.
Solved! Go to Solution.
Chris,
So when you run the initial query you get an array of features. So just use that array of features and use your position in the array (your index) to return the individual record from your array when the user clicks next just add to your index var.
var myArr = queryResuts.features;
var myRecLen = myArr.length - 1;
var myIndex = 0;
var frmRec = myArr[myIndex];
//next button clicked
myIndex++;
if(myIndex <= myRecLen){
frmRec = myArr[myIndex];
}else{
myIndex = myRecLen;
frmRec = myArr[myRecLen];
}
//previous button clicked
myIndex--;
if(myIndex >= 0){
frmRec = myArr[myIndex];
}else{
myIndex = 0;
frmRec = myArr[0];
}
Chris,
Not sure I understand the question here but this url will get you just the count:
I do know how to do that. Maybe this video will help:
Chris,
So when you run the initial query you get an array of features. So just use that array of features and use your position in the array (your index) to return the individual record from your array when the user clicks next just add to your index var.
var myArr = queryResuts.features;
var myRecLen = myArr.length - 1;
var myIndex = 0;
var frmRec = myArr[myIndex];
//next button clicked
myIndex++;
if(myIndex <= myRecLen){
frmRec = myArr[myIndex];
}else{
myIndex = myRecLen;
frmRec = myArr[myRecLen];
}
//previous button clicked
myIndex--;
if(myIndex >= 0){
frmRec = myArr[myIndex];
}else{
myIndex = 0;
frmRec = myArr[0];
}
I'll try adding this code in with the query and let you know how it goes.
I need to figure this out: How Do I Return An Array From My Query? before I can try your code here.
This is what how I want to navigate the form. Thanks.