• Priyanshu Singh
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
public class clsShowCarousel {
    @AuraEnabled
    public static list<string> fetchPropertyImages(string RecordId){
        list<string> formulaFieldURL = new list<string>();
		//list<string> imageUrl = new list<string>();
		//list<string> lstAltText = new list<string>(); 
		list<WrapperClass> lstWrap = new list<WrapperClass>(); 
		
        list<Property__c> lstOfformulaFields = new list<Property__c>();
        
        lstOfformulaFields = [select id,ImageFormula1__c,ImageFormula2__c,ImageFormula3__c,ImageFormula4__c,ImageFormula5__c,ImageFormula6__c,ImageFormula7__c,ImageFormula8__c,ImageFormula9__c,ImageFormula10__c,ImageFormula11__c,ImageFormula12__c,ImageFormula13__c,ImageFormula14__c,ImageFormula15__c,ImageFormula16__c,ImageFormula17__c,ImageFormula18__c,ImageFormula19__c,ImageFormula20__c,Front_Image__c,Side_Image__c,Rear_Image__c,Near_Image__c from Property__c where id =: RecordId];
        
        if(lstOfformulaFields.size()>0){
			
			if(lstOfformulaFields[0].Front_Image__c != null && lstOfformulaFields[0].Front_Image__c != '')
				formulaFieldURL.add(lstOfformulaFields[0].Front_Image__c);
			if(lstOfformulaFields[0].Side_Image__c != null && lstOfformulaFields[0].Side_Image__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].Side_Image__c);
			if(lstOfformulaFields[0].Rear_Image__c != null && lstOfformulaFields[0].Rear_Image__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].Rear_Image__c);
			if(lstOfformulaFields[0].Near_Image__c != null && lstOfformulaFields[0].Near_Image__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].Near_Image__c);
            if(lstOfformulaFields[0].ImageFormula1__c != null && lstOfformulaFields[0].ImageFormula1__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula1__c);
            if(lstOfformulaFields[0].ImageFormula2__c != null && lstOfformulaFields[0].ImageFormula2__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula2__c);
            if(lstOfformulaFields[0].ImageFormula3__c != null && lstOfformulaFields[0].ImageFormula3__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula3__c);
            if(lstOfformulaFields[0].ImageFormula4__c != null && lstOfformulaFields[0].ImageFormula4__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula4__c);
            if(lstOfformulaFields[0].ImageFormula5__c != null && lstOfformulaFields[0].ImageFormula5__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula5__c);
            if(lstOfformulaFields[0].ImageFormula6__c != null && lstOfformulaFields[0].ImageFormula6__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula6__c);
            if(lstOfformulaFields[0].ImageFormula7__c != null && lstOfformulaFields[0].ImageFormula7__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula7__c);
            if(lstOfformulaFields[0].ImageFormula8__c != null && lstOfformulaFields[0].ImageFormula8__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula8__c);
            if(lstOfformulaFields[0].ImageFormula9__c != null && lstOfformulaFields[0].ImageFormula9__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula9__c);
            if(lstOfformulaFields[0].ImageFormula10__c != null && lstOfformulaFields[0].ImageFormula10__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula10__c);
            if(lstOfformulaFields[0].ImageFormula11__c != null && lstOfformulaFields[0].ImageFormula11__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula11__c);
            if(lstOfformulaFields[0].ImageFormula12__c != null && lstOfformulaFields[0].ImageFormula12__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula12__c);
            if(lstOfformulaFields[0].ImageFormula13__c != null && lstOfformulaFields[0].ImageFormula13__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula13__c);
            if(lstOfformulaFields[0].ImageFormula14__c != null && lstOfformulaFields[0].ImageFormula14__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula14__c);
            if(lstOfformulaFields[0].ImageFormula15__c != null && lstOfformulaFields[0].ImageFormula15__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula15__c);
            if(lstOfformulaFields[0].ImageFormula16__c != null && lstOfformulaFields[0].ImageFormula16__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula16__c);
            if(lstOfformulaFields[0].ImageFormula17__c != null && lstOfformulaFields[0].ImageFormula17__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula17__c);
            if(lstOfformulaFields[0].ImageFormula18__c != null && lstOfformulaFields[0].ImageFormula18__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula18__c);
            if(lstOfformulaFields[0].ImageFormula19__c != null && lstOfformulaFields[0].ImageFormula19__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula19__c);
            if(lstOfformulaFields[0].ImageFormula20__c != null && lstOfformulaFields[0].ImageFormula20__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula20__c);
			
        }
		string altText = '';
		for(string strFieldValue :formulaFieldURL){
			if(strFieldValue!=null && strFieldValue!=''){
				WrapperClass objWrap = new WrapperClass();
				altText = strFieldValue.substringBetween('alt=','border');
				altText = altText.remove('"');
				
				strFieldValue = strFieldValue.substringBetween('src=', 'alt');
				strFieldValue = strFieldValue.remove('"');
				objWrap.alternativeText = altText;
				objWrap.url = strFieldValue;
					lstWrap.add(objWrap);
			}
		}
		return lstWrap;
    }
	public class WrapperClass{
		@AuraEnabled
		public string url {get;set;}
		@AuraEnabled
		public string alternativeText {get;set;}
	}
}

 
public class clsShowCarousel {
    @AuraEnabled
    public static list<string> fetchPropertyImages(string RecordId){
        list<string> formulaFieldURL = new list<string>();
		//list<string> imageUrl = new list<string>();
		//list<string> lstAltText = new list<string>(); 
		list<WrapperClass> lstWrap = new list<WrapperClass>(); 
		
        list<Property__c> lstOfformulaFields = new list<Property__c>();
        
        lstOfformulaFields = [select id,ImageFormula1__c,ImageFormula2__c,ImageFormula3__c,ImageFormula4__c,ImageFormula5__c,ImageFormula6__c,ImageFormula7__c,ImageFormula8__c,ImageFormula9__c,ImageFormula10__c,ImageFormula11__c,ImageFormula12__c,ImageFormula13__c,ImageFormula14__c,ImageFormula15__c,ImageFormula16__c,ImageFormula17__c,ImageFormula18__c,ImageFormula19__c,ImageFormula20__c,Front_Image__c,Side_Image__c,Rear_Image__c,Near_Image__c from Property__c where id =: RecordId];
        
        if(lstOfformulaFields.size()>0){
			
			if(lstOfformulaFields[0].Front_Image__c != null && lstOfformulaFields[0].Front_Image__c != '')
				formulaFieldURL.add(lstOfformulaFields[0].Front_Image__c);
			if(lstOfformulaFields[0].Side_Image__c != null && lstOfformulaFields[0].Side_Image__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].Side_Image__c);
			if(lstOfformulaFields[0].Rear_Image__c != null && lstOfformulaFields[0].Rear_Image__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].Rear_Image__c);
			if(lstOfformulaFields[0].Near_Image__c != null && lstOfformulaFields[0].Near_Image__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].Near_Image__c);
            if(lstOfformulaFields[0].ImageFormula1__c != null && lstOfformulaFields[0].ImageFormula1__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula1__c);
            if(lstOfformulaFields[0].ImageFormula2__c != null && lstOfformulaFields[0].ImageFormula2__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula2__c);
            if(lstOfformulaFields[0].ImageFormula3__c != null && lstOfformulaFields[0].ImageFormula3__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula3__c);
            if(lstOfformulaFields[0].ImageFormula4__c != null && lstOfformulaFields[0].ImageFormula4__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula4__c);
            if(lstOfformulaFields[0].ImageFormula5__c != null && lstOfformulaFields[0].ImageFormula5__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula5__c);
            if(lstOfformulaFields[0].ImageFormula6__c != null && lstOfformulaFields[0].ImageFormula6__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula6__c);
            if(lstOfformulaFields[0].ImageFormula7__c != null && lstOfformulaFields[0].ImageFormula7__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula7__c);
            if(lstOfformulaFields[0].ImageFormula8__c != null && lstOfformulaFields[0].ImageFormula8__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula8__c);
            if(lstOfformulaFields[0].ImageFormula9__c != null && lstOfformulaFields[0].ImageFormula9__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula9__c);
            if(lstOfformulaFields[0].ImageFormula10__c != null && lstOfformulaFields[0].ImageFormula10__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula10__c);
            if(lstOfformulaFields[0].ImageFormula11__c != null && lstOfformulaFields[0].ImageFormula11__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula11__c);
            if(lstOfformulaFields[0].ImageFormula12__c != null && lstOfformulaFields[0].ImageFormula12__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula12__c);
            if(lstOfformulaFields[0].ImageFormula13__c != null && lstOfformulaFields[0].ImageFormula13__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula13__c);
            if(lstOfformulaFields[0].ImageFormula14__c != null && lstOfformulaFields[0].ImageFormula14__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula14__c);
            if(lstOfformulaFields[0].ImageFormula15__c != null && lstOfformulaFields[0].ImageFormula15__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula15__c);
            if(lstOfformulaFields[0].ImageFormula16__c != null && lstOfformulaFields[0].ImageFormula16__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula16__c);
            if(lstOfformulaFields[0].ImageFormula17__c != null && lstOfformulaFields[0].ImageFormula17__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula17__c);
            if(lstOfformulaFields[0].ImageFormula18__c != null && lstOfformulaFields[0].ImageFormula18__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula18__c);
            if(lstOfformulaFields[0].ImageFormula19__c != null && lstOfformulaFields[0].ImageFormula19__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula19__c);
            if(lstOfformulaFields[0].ImageFormula20__c != null && lstOfformulaFields[0].ImageFormula20__c != '')
                formulaFieldURL.add(lstOfformulaFields[0].ImageFormula20__c);
			
        }
		string altText = '';
		for(string strFieldValue :formulaFieldURL){
			if(strFieldValue!=null && strFieldValue!=''){
				WrapperClass objWrap = new WrapperClass();
				altText = strFieldValue.substringBetween('alt=','border');
				altText = altText.remove('"');
				
				strFieldValue = strFieldValue.substringBetween('src=', 'alt');
				strFieldValue = strFieldValue.remove('"');
				objWrap.alternativeText = altText;
				objWrap.url = strFieldValue;
					lstWrap.add(objWrap);
			}
		}
		return lstWrap;
    }
	public class WrapperClass{
		@AuraEnabled
		public string url {get;set;}
		@AuraEnabled
		public string alternativeText {get;set;}
	}
}