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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Thingworx mashup service execution cases

Jamal8548
11-Garnet

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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
Jimwang
14-Alexandrite
(To:Jamal8548)

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

}

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");
Top Tags