Hi
Iam trying to validate a new project name by checking wheather the name is already present in the table or not . I try to acheive this action by loading a list grid when user clicks on save button after entering the new name when user clicks save i include the newly given name and another deleted flag as criteria and pass it along with ds request and get the count of total rows fetched on basis of applied criteria . If name is already present in the table result will be greater than 0 else the result will be 0 . But in my case It looks criteria which i passed along with DS request is not reflected in the result
This is the DS request generated in RPC
{
dataSource:"count",
operationType:"fetch",
componentId:"isc_ListGrid_9",
data:{
operator:"and",
criteria:[
{
fieldName:"ProjectName",
operator:"equals",
value:"Testingprojectname"
},
{
fieldName:"DeletedFlag",
operator:"equals",
value:0
}
]
},
startRow:0,
endRow:75,
textMatchStyle:"exact",
resultSet:[ResultSet ID:isc_ResultSet_10 (created by: isc_ListGrid_9)],
callback:{
caller:[ResultSet ID:isc_ResultSet_10 (created by: isc_ListGrid_9)],
methodName:"fetchRemoteDataReply"
},
willHandleError:true,
showPrompt:true,
prompt:"Finding Records that match your criteria...",
oldValues:{
operator:"and",
criteria:[
{
fieldName:"ProjectName",
operator:"equals",
value:"Testingprojectname"
},
{
fieldName:"DeletedFlag",
operator:"equals",
value:0
}
]
},
requestId:"count$62712",
internalClientContext:{
requestIndex:1
},
fallbackToEval:false,
lastClientEventThreadCode:"MMV8",
bypassCache:true
}
This is the raw response in RPC
[
{
affectedRows:0,
data:[
{
User_ID:"26280",
Project_ID:6,
ProjectName:"General Category",
DeletedFlag:false
},
{
User_ID:"000012",
Project_ID:7,
ProjectName:"first test",
DeletedFlag:true
},
{
User_ID:"000012",
Project_ID:8,
ProjectName:"New Test",
DeletedFlag:true
},
{
User_ID:"000012",
Project_ID:19, ........
continued....
This is the DS request code
final ListGrid chckgrid= new ListGrid(); chckgrid.setDataSource(DataSource.getDataSource("count"));
Criteria chkcrit = new AdvancedCriteria(OperatorId.AND, new Criterion[]
{
new Criterion("ProjectName",OperatorId.EQUALS,Clipname.getText().toString()),
new Criterion("DeletedFlag", OperatorId.EQUALS,0),
});
DSRequest dsRequest = new DSRequest();
chckgrid.fetchData(chkcrit,new DSCallback()
{
public void execute(DSResponse response, Object o, DSRequest request) {
chckgrid.setData(response.getData());
int totalcount=response.getTotalRows();
Window.alert("the total count is "+totalcount);
}
,dsRequest);
Currently iam getting count value as 260 which is fetched based on user_id alone .But i should get count value as 0 if given name is not available in the table
So I need to get the result which reflects the applied criteria . Thanks in advance
Iam trying to validate a new project name by checking wheather the name is already present in the table or not . I try to acheive this action by loading a list grid when user clicks on save button after entering the new name when user clicks save i include the newly given name and another deleted flag as criteria and pass it along with ds request and get the count of total rows fetched on basis of applied criteria . If name is already present in the table result will be greater than 0 else the result will be 0 . But in my case It looks criteria which i passed along with DS request is not reflected in the result
This is the DS request generated in RPC
{
dataSource:"count",
operationType:"fetch",
componentId:"isc_ListGrid_9",
data:{
operator:"and",
criteria:[
{
fieldName:"ProjectName",
operator:"equals",
value:"Testingprojectname"
},
{
fieldName:"DeletedFlag",
operator:"equals",
value:0
}
]
},
startRow:0,
endRow:75,
textMatchStyle:"exact",
resultSet:[ResultSet ID:isc_ResultSet_10 (created by: isc_ListGrid_9)],
callback:{
caller:[ResultSet ID:isc_ResultSet_10 (created by: isc_ListGrid_9)],
methodName:"fetchRemoteDataReply"
},
willHandleError:true,
showPrompt:true,
prompt:"Finding Records that match your criteria...",
oldValues:{
operator:"and",
criteria:[
{
fieldName:"ProjectName",
operator:"equals",
value:"Testingprojectname"
},
{
fieldName:"DeletedFlag",
operator:"equals",
value:0
}
]
},
requestId:"count$62712",
internalClientContext:{
requestIndex:1
},
fallbackToEval:false,
lastClientEventThreadCode:"MMV8",
bypassCache:true
}
This is the raw response in RPC
[
{
affectedRows:0,
data:[
{
User_ID:"26280",
Project_ID:6,
ProjectName:"General Category",
DeletedFlag:false
},
{
User_ID:"000012",
Project_ID:7,
ProjectName:"first test",
DeletedFlag:true
},
{
User_ID:"000012",
Project_ID:8,
ProjectName:"New Test",
DeletedFlag:true
},
{
User_ID:"000012",
Project_ID:19, ........
continued....
This is the DS request code
final ListGrid chckgrid= new ListGrid(); chckgrid.setDataSource(DataSource.getDataSource("count"));
Criteria chkcrit = new AdvancedCriteria(OperatorId.AND, new Criterion[]
{
new Criterion("ProjectName",OperatorId.EQUALS,Clipname.getText().toString()),
new Criterion("DeletedFlag", OperatorId.EQUALS,0),
});
DSRequest dsRequest = new DSRequest();
chckgrid.fetchData(chkcrit,new DSCallback()
{
public void execute(DSResponse response, Object o, DSRequest request) {
chckgrid.setData(response.getData());
int totalcount=response.getTotalRows();
Window.alert("the total count is "+totalcount);
}
,dsRequest);
Currently iam getting count value as 260 which is fetched based on user_id alone .But i should get count value as 0 if given name is not available in the table
So I need to get the result which reflects the applied criteria . Thanks in advance
Comment