Skip to content

Instantly share code, notes, and snippets.

@iberck
Created October 21, 2017 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iberck/898226fc12a5cf91076ddeb149e6b006 to your computer and use it in GitHub Desktop.
Save iberck/898226fc12a5cf91076ddeb149e6b006 to your computer and use it in GitHub Desktop.
No permite elegir la columna ninguno en una pregunta de matriz
function onNextUI(answer) {
    var matrixJsonObj = answer.getEnterMatrix(); 
    var options = matrixJsonObj.names();
    for (var i = 0; i < options.length(); i++) {
        var optionAlias = options.get(i);
        var opt = ApiClient.findItem(optionAlias);
        var jsonArrayColumns = matrixJsonObj.get(optionAlias);
        var colsSelValues = [];
        for (var j = 0; j < jsonArrayColumns.length(); j++) {
            var colAlias = jsonArrayColumns.get(j);
            var col = ApiClient.findItem(colAlias);
            colsSelValues.push(""+col.getValue());
        }

        if (colsSelValues.indexOf("9")>-1 && colsSelValues.length>1) {
            throw new ValidationException('('+opt.getText()+'): No puede elegir otras columnas si elige la columna Ninguno');    
        }
    }   
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment