How to compare one list dinamic with a static value ?
I need to compare the variable static " modelX " with the list " modelA " using SOQL query.
*The Variable "modelA" contain this values into SOQL query: {'ZTEG-F660','8245B','HG8145V5','8245H','MA5675M','ZTEG-F670'}
String modelA;
String modelX = 'HG8145V5';
List<Cambio_Equipo_ONT__c> modelosONTA = [SELECT Id, Name, Modelo__c, Equipo_Puede_Cambiar__c FROM Cambio_Equipo_ONT__c WHERE Equipo_Puede_Cambiar__c = 'PSTVENTA'];
for(Cambio_Equipo_ONT__c ontA : modelosONTA) {
modelA = ontA.Modelo__c;
System.debug(modelA);
}
if(modelX.contains(modelA)) {
System.debug('Have the same device: ' + modelX + ' _______ ' + modelA);
}
Hi Cristino,
Try thisString modelA;
String modelX = 'HG8145V5';
List<Cambio_Equipo_ONT__c> modelosONTA = [SELECT Id, Name, Modelo__c, Equipo_Puede_Cambiar__c FROM Cambio_Equipo_ONT__c WHERE Equipo_Puede_Cambiar__c = 'PSTVENTA'];
for(Cambio_Equipo_ONT__c ontA : modelosONTA) {
modelA = ontA.Modelo__c;
System.debug(modelA);
if ( modelX = modelA) {
System.debug('Have the same device: ' + modelX + ' _______ ' + modelA);
}
}