william_roe
10 years agoSuper Contributor
Pushing Items onto Array
How do you push items onto an array? The following throws an exception. function ReadAllCribs() {
var AllCribs = {};
Project.Variables.Cribs.Reset();
for (; !Project.Variables.Cr...
- 10 years ago
Your all cribs array object should be created with square brackets, using braces creates an object not an array object. I'm going to take a guess here and assume you were trying to append the value with a string "CribNumber" before adding it to array.
function readAllCribs() { var allCribs = []; Project.Variables.Cribs.Reset(); while (!Project.Variables.Cribs.IsEOF() { allCribs.push("CribNumber" + Project.Variables.Cribs.Value); Project.Variables.Cribs.Next(); } }
}