function validateCatalog(id, type) {
  array[id].validation = [];
  var categories = [...new Set(array[id].data.map(x => x.category))];
  var settings = validationSettings["interaction studio"][type];
  // check schema matches
  if(JSON.stringify(array[id].meta.fields) == JSON.stringify(settings.schema)){
    array[id].validation.push(settings.messages.schema[1]);
  } else {
    array[id].validation.push(settings.messages.schema[0]); 
  }
  // check fields count
  if(array[id].meta.fields.length > settings.schema.length){
    array[id].validation.push(settings.messages.fieldCount[0]);
  }
  // check min row count
  if(array[id].data.length >= settings.minRows){
    array[id].validation.push(settings.messages.rowCount[1]);
  } else {
    array[id].validation.push(settings.messages.rowCount[0]); 
  }
  // check min category count
  if(categories.length >= settings.minCategories){
    array[id].validation.push(settings.messages.categoryCount[1]);
  } else {
    array[id].validation.push(settings.messages.categoryCount[0]); 
  }
}
// Function to validate each catalog type based on default settings
Function to validate each catalog type based on default settings
Function to validate each catalog type based on default settings
function validateCatalog(id, type) {
  array[id].validation = [];
  var categories = [...new Set(array[id].data.map(x => x.category))];
  var settings = validationSettings["interaction studio"][type];
  if(JSON.stringify(array[id].meta.fields) == JSON.stringify(settings.schema)){
    array[id].validation.push(settings.messages.schema[1]);
  } else {
    array[id].validation.push(settings.messages.schema[0]); 
  }
  if(array[id].meta.fields.length > settings.schema.length){
    array[id].validation.push(settings.messages.fieldCount[0]);
  }
  if(array[id].data.length >= settings.minRows){
    array[id].validation.push(settings.messages.rowCount[1]);
  } else {
    array[id].validation.push(settings.messages.rowCount[0]); 
  }
  if(categories.length >= settings.minCategories){
    array[id].validation.push(settings.messages.categoryCount[1]);
  } else {
    array[id].validation.push(settings.messages.categoryCount[0]); 
  }
}
function validateCatalog ( id , type ) { array [ id ] . validation = [ ] ; var categories = [ ... new Set ( array [ id ] . data . map ( x => x . category ) ) ] ; var settings = validationSettings [ "interaction studio" ] [ type ] ; if ( JSON . stringify ( array [ id ] . meta . fields ) == JSON . stringify ( settings . schema ) ) { array [ id ] . validation . push ( settings . messages . schema [ 1 ] ) ; } else { array [ id ] . validation . push ( settings . messages . schema [ 0 ] ) ; } if ( array [ id ] . meta . fields . length > settings . schema . length ) { array [ id ] . validation . push ( settings . messages . fieldCount [ 0 ] ) ; } if ( array [ id ] . data . length >= settings . minRows ) { array [ id ] . validation . push ( settings . messages . rowCount [ 1 ] ) ; } else { array [ id ] . validation . push ( settings . messages . rowCount [ 0 ] ) ; } if ( categories . length >= settings . minCategories ) { array [ id ] . validation . push ( settings . messages . categoryCount [ 1 ] ) ; } else { array [ id ] . validation . push ( settings . messages . categoryCount [ 0 ] ) ; } }
Function to validate each catalog type based on default settings
Function to validate each catalog type based on default settings
// check schema matches // check fields count // check min row count // check min category count