본문 바로가기
WEB/넥사크로

(넥사크로 14) lookupExpr 함수, - 넥사크로 라이브러리함수

by iiaii 2018. 12. 13.
반응형

/************************************** 넥사크로 라이브러리 함수 lookupExpr 설명 

// Adding customized lookupExpr function will be added to Data.js 

// This function will compare the first condition and find the row position with respect to first condition.

// With respect to the row, it will return the value of the col3 of dataset.

// Example it will find the row position of col1 = 'a' and col2 = 'b' which is 2, then find the value of "col3" column, which is "Resulted Column" 

// Input parameter Parameter 1. expression condition,2. column, which value should be found matching with first column's condition. 

************************************/

_pDataset.lookupExpr = function (expr, outcol) 

 {

  var view = this._viewRecords;

  var start = 0;

  var end = view.length;


  var row = this.findRowExpr(expr, start, end); 

  // calls the findRowExpr function of Data.js from inside. 

  

  return (row == -1) ? undefined : this.getColumn(row, outcol);

 };


======================================================================


 /*******************************************************************************

 * Function Name: lookupExpr4

 * Description : 테스트 색상

 * Arguments : facCode, LineCode

 * Return

 ********************************************************************************/

_pDataset.lookupExpr4 = function (expr) 

 {

  var view = this._viewRecords;

var start = 0;

var end = view.length;


var row = this.findRowExpr(expr, start, end); 

// calls the findRowExpr function of Data.js from inside. 

var col1 = (row == -1) ? undefined : this.getColumn(row, "INSP_1TH_LED");

var col2 = (row == -1) ? undefined : this.getColumn(row, "INSP_2ND_LED");

var col3 = (row == -1) ? undefined : this.getColumn(row, "INSP_3TH_LED");

var rstRtn = new Array(col1, col2, col3)

//var rstRtn = col1;

return rstRtn;

 };

 

/*******************************************************************************

 * Function Name: fn_progCr

 * Description : 상태 배경색상

 * Arguments : comp.parent.parent.fn_progCr("FAC_CD","LINE_CD")

 * Return

 ********************************************************************************/

this.fn_progCr = function(facTypeCode, lineCode)

{

  var rstCr = this.ds_List.lookupExpr4("FAC_NM == '"+facTypeCode+"' && LINE_CD == '"+lineCode+"'");

 

  var rtnCr;

  if(rstCr[0] == "WHITE"){

  rtnCr = "white";

  }else if(rstCr[0] == "BLUE"){

rtnCr = "blue";

  }else{

rtnCr = rstCr[0].toLowerCase();

  }

 

  return rtnCr;

}



반응형