cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Thingworx mashup service execution cases

MA8731174
14-Alexandrite

Thingworx mashup service execution cases

Hi Developers,

I have a service which loads the data on mashup in gridadvanced. I have a textfield which takes searchinput so 

 

if (searchinput !== "") {

then i run the service to get data for that input which is given in text field

}

 

else if (searchinput === ""){

means i have not written anything in textfield then i am just showing a complete datatable entries on grid

}


Now new requirement came that the user can select startdate enddate and get that entries on mashup. Any suggestions for best practices how can i do that? I think i have limited the existing service to run on  only in two conditions. how can i expand it. any ideas or suggestions?

ACCEPTED SOLUTION

Accepted Solutions
MA8731174
14-Alexandrite
(To:Jimwang)

I think its fine i have done it.
   
if (searchinput !== "") { result=me.getEntryWithSerialNumberIntoMashup({
        
    
lineNames: lineNames ,
selectedFilterStatus: selectedFilterStatus,
    selectedProducts:selectedProducts,
searchinput: searchinput 
 });
    
}
 
 
else if (searchinput == "" && (startDate === undefined || endDate === undefined))
 {
  
    
    result=me.getAllEntriesIntoMashup({
lineNames: lineNames ,
selectedFilterStatus: selectedFilterStatus,
    selectedProducts:selectedProducts,
searchinput: "" 
});
    
}  
 
else if(startDate !== undefined && endDate !== undefined) {
 
 
    result=me.getEntriesWithDateLimitIntoMashup({
lineNames: lineNames ,
selectedFilterStatus: selectedFilterStatus ,
    selectedProducts:selectedProducts,
    startDate:startDate,
    endDate:endDate
});
}
logger.info(me.name +" :: "+ serviceName +" :: End Service");

View solution in original post

2 REPLIES 2

How do you query the data with Start Date and End Date?

 

if (searchinput !== "") {

      Query the data with the filter "searchinput", "Start Date" and "End Date"

}

else if (searchinput === ""){

    Query the data with "Start Date" and "End Date" only

}

MA8731174
14-Alexandrite
(To:Jimwang)

I think its fine i have done it.
   
if (searchinput !== "") { result=me.getEntryWithSerialNumberIntoMashup({
        
    
lineNames: lineNames ,
selectedFilterStatus: selectedFilterStatus,
    selectedProducts:selectedProducts,
searchinput: searchinput 
 });
    
}
 
 
else if (searchinput == "" && (startDate === undefined || endDate === undefined))
 {
  
    
    result=me.getAllEntriesIntoMashup({
lineNames: lineNames ,
selectedFilterStatus: selectedFilterStatus,
    selectedProducts:selectedProducts,
searchinput: "" 
});
    
}  
 
else if(startDate !== undefined && endDate !== undefined) {
 
 
    result=me.getEntriesWithDateLimitIntoMashup({
lineNames: lineNames ,
selectedFilterStatus: selectedFilterStatus ,
    selectedProducts:selectedProducts,
    startDate:startDate,
    endDate:endDate
});
}
logger.info(me.name +" :: "+ serviceName +" :: End Service");
Announcements


Top Tags