• Abhijith E 4
  • NEWBIE
  • 0 Points
  • Member since 2015


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi All,

I have a requirement where I am required to search if a field from list<customobject> contains any one value from anoher list.

here the field is a LongTextArea hence i am not able to use any formula , as i have long list of Keywords which i need to check i have written below logic.

String alp ;
List<String> lstAlpha =  new List<String>{'Keyword 1','Keyword 2','Keyword 3'}; // List of Keywords to be searched
integer i = 0;
System.debug('List Values--->'+lstAlpha);
List<Abc__c> lst = [SELECT id,name,LongTextAreafield__c from Abc__c where status = 'open'];
for( Abc__c ls:lst)
{
    alp = ls.LongTextAreafield__c;
    // iterating one list in another
    do {
        if (alp.contains(lstAlpha[i])) // checking 1st list field contains keyword or not
        {system.debug ('Check Successfull');  }
        System.debug('Value of i =====>>>>'+i);
        i++;
    }
    while (i < lstAlpha.size());
    // I can use any loop but as its not best practice I want to aviod nested loops

}
system.debug ('alp contents ==== '+alp);


Issue here is I had to use Nested loops which is not best practice can anyone suggest a better solution to this requirement?

 
I am trying to use kendo UI in a lightning component to get a scheduler to be a custom lightning component. My component is:
 
<aura:component >
	<ltng:require
    	styles="{!join(',', $Resource.kendoUI + '/kendo-ui/styles/kendo.silver.min.css', $Resource.kendoUI + '/kendo-ui/styles/kendo.default.mobile.min', $Resource.kendoUI + '/kendo-ui/styles/kendo.default.min')}"
    	scripts="{!join(',', $Resource.kendoUI + '/kendo-ui/js/jquery.min.js', $Resource.kendoUI + '/kendo-ui/js/kendo.all.min.js', $Resource.kendoUI + '/kendo-ui/js/kendo.timezones.min.js')}"/>
    <aura:attribute name="scheduler" type="Object"/>
    <aura:handler name="init" value="{!this}" action="{!c.schedulerInit}"/>
    
	<div aura:id="{!v.scheduler}"></div>

</aura:component>

and controller is:
({
	schedulerInit : function(component, event, helper) {
		var scheduler = component.find("scheduler");
        console.log(scheduler);
        scheduler.kendoScheduler({
        date: new Date("2013/6/13"),
        startTime: new Date("2013/6/13 07:00 AM"),
        height: 600,
        views: [
            "day",
            { type: "workWeek", selected: true },
            "week",
            "month",
            "agenda",
            { type: "timeline", eventHeight: 50}
        ],
        timezone: "Etc/UTC",
        dataSource: {
            batch: true,
            transport: {
                read: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks",
                    dataType: "jsonp"
                },
                update: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks/update",
                    dataType: "jsonp"
                },
                create: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks/create",
                    dataType: "jsonp"
                },
                destroy: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks/destroy",
                    dataType: "jsonp"
                },
                parameterMap: function(options, operation) {
                    if (operation !== "read" && options.models) {
                        return {models: kendo.stringify(options.models)};
                    }
                }
            },
            schema: {
                model: {
                    id: "taskId",
                    fields: {
                        taskId: { from: "TaskID", type: "number" },
                        title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                        start: { type: "date", from: "Start" },
                        end: { type: "date", from: "End" },
                        startTimezone: { from: "StartTimezone" },
                        endTimezone: { from: "EndTimezone" },
                        description: { from: "Description" },
                        recurrenceId: { from: "RecurrenceID" },
                        recurrenceRule: { from: "RecurrenceRule" },
                        recurrenceException: { from: "RecurrenceException" },
                        ownerId: { from: "OwnerID", defaultValue: 1 },
                        isAllDay: { type: "boolean", from: "IsAllDay" }
                    }
                }
            },
            filter: {
                logic: "or",
                filters: [
                    { field: "ownerId", operator: "eq", value: 1 },
                    { field: "ownerId", operator: "eq", value: 2 }
                ]
            }
        },
        resources: [
            {
                field: "ownerId",
                title: "Owner",
                dataSource: [
                    { text: "Alex", value: 1, color: "#f8a398" },
                    { text: "Bob", value: 2, color: "#51a0ed" },
                    { text: "Charlie", value: 3, color: "#56ca85" }
                ]
            }
        ]
    });
	}
})

which is just the kendo UI scheduler demo example on their website, just trying to see if I can get it to show up at all. However, I cannot doing it like this. My application is simply:
 
<aura:application access="GLOBAL" extends="ltng:outApp">
    <c:kendo_test />
</aura:application>

but when I preview, I just get a forever loading sign with no errors popping up on the screen or chrome dev tools console. The console.log in the controller is not being hit and printed on the console at all... 

Does anyone have experience using kendo or any kind of outside objects in lightning components and can help me by showing me how to call them? I assume I cannot set 'type' of te attribute to 'kendoScheduler'... but then I don't know how to call the scheduler function to initialize it. I tried doing aura:method after the scheduler div in the component, but that didn't work either.

Thank you for any help!