Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
502 views

Query for function in SL

Jump to solution

Can you help.

I need make a query in function and query have compare for 2 arguments of function. (what syntax)

 

 

function fName(arg1, arg2)
...
if (var findRecord=currentFile.doSelect(arg1=arg2) == RC_SUCCESS)
...

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Knowledge Partner
Knowledge Partner

Re: Query for function in SL

Jump to solution

Hi ALARMus,

I suppose that the first argument is the name of the field you wanna search for.

If this is the case just use as argument:  arg1 + '="' + arg2 + '"'


Example:

searchCall("incident.id","SD12908"); 

function searchCall(arg1, arg2){
	
	query=arg1 + '="' + arg2 + '"';	

	var fIncidents = new SCFile("incidents");
	var rc = fIncidents.doSelect(query);	
	
	print(fIncidents.incident_id);

}
Regards,
Breno Abreu

If you feel this was helpful please click the KUDOS! thumb below!

View solution in original post

3 Replies
Highlighted
Knowledge Partner
Knowledge Partner

Re: Query for function in SL

Jump to solution

Hi ALARMus,

I suppose that the first argument is the name of the field you wanna search for.

If this is the case just use as argument:  arg1 + '="' + arg2 + '"'


Example:

searchCall("incident.id","SD12908"); 

function searchCall(arg1, arg2){
	
	query=arg1 + '="' + arg2 + '"';	

	var fIncidents = new SCFile("incidents");
	var rc = fIncidents.doSelect(query);	
	
	print(fIncidents.incident_id);

}
Regards,
Breno Abreu

If you feel this was helpful please click the KUDOS! thumb below!

View solution in original post

Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Query for function in SL

Jump to solution
query=arg1 + '="' + arg2 + '"';

 

I think you mean

VAR query=arg1 + '="' + arg2 + '"';

 

0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: Query for function in SL

Jump to solution

Never forget to check the result code! 😉

searchCall('incident.id','SD10032');

function searchCall(arg1, arg2){

	var query       = arg1 + '="' + arg2 + '"';
	var fIncidents  = new SCFile('incidents');
	var rc          = fIncidents.doSelect(query);

    if (rc == RC_SUCCESS) {
        print(fIncidents.incident_id);
    }
}

Bo

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.