Expand my Community achievements bar.

SOLVED

Following the Purchase Order sample

Avatar

Level 7

and I'm stuck on this line of script:

partNoScript.populatePartNo(

this);

What does PartNo refer to?

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Yes.

'populatePartNo'  is the function name. 'partNo' is the array name. Since 'partNo' is defined outside of a function it is available to all functions in the script object. The 'populatePartNo' function iterates over the 'partNo' array adding each child to the drop-down.

Steve

View solution in original post

6 Replies

Avatar

Former Community Member
populatePartNo is a function in the script object PartNoScript.
    
// Populate the part number Drop-down List.
function populatePartNo(dropdownField)
{
      var i;
      for (i=0; i < partNo.length; i++)
         dropdownField.addItem(partNo[i]);
}
    
Steve

Avatar

Level 7

Thank you. What does the specific phrase PartNo refer to. The dropdownfield is named txtPartNum and the var in the script is called partNo. The capitalization is throwing me, I guess.

Thanks,

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Former Community Member

PartNo is an array defined in the PartNoScript script object. It contains the values that are loaded into the drop-down.

// Array of part numbers.

var partNo = new Array(" ",

   "580463116",

   "25906311C",

   "25129637J",

   "771128",

   "11198262A",

   "57251",

   "25906312A",

   "51615223D",

   "51615224D",

   "516154CAC");

Avatar

Level 7

So it's OK that in the populate function the phrase is capitalized as PartNo although the var is partNo?

Thanks,

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Correct answer by
Former Community Member

Yes.

'populatePartNo'  is the function name. 'partNo' is the array name. Since 'partNo' is defined outside of a function it is available to all functions in the script object. The 'populatePartNo' function iterates over the 'partNo' array adding each child to the drop-down.

Steve

Avatar

Level 7

Thanks.

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----