on 12-09-2014 11:21 AM
What error are you getting?
thanks
Nanda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is it that you try to achieve here. Will this code be part of a bigger application? Based on these few lines there is very little we can say.
If you are really looking into adding functionality using RedwoodScript I would suggest to take a course on either RedwoodScript or Java.
Regards Gerben
Hi Vishnu,
As Gerben says, we cannot say from your code snippet which, as I had pointed out in the other thread, contains typos. This is certainly NOT the code that caused that error - you will not be able to save the above code in a job definition editor.
Please copy & paste the actual code you are using, preferably all of it, not just the snippet where an error occurs.
Besides, why are you using "long object" as a APIResultSetCallback ? Please see the example in the API documentation for using jcsSession.executeQuery().
You should consider jcsSession.executeObjectQuery(); that one does not need an APIResultSetCallback and is easier to handle.
Regards,
HP
Hi All,
My scenario is this.
I will pass jobId as parameter and get the status of that job. Once I get the status, I will update an user-defined table.
I am executing this script in shell as of now by hard-coding jobId in the query.
String query = "select job.JobDefinition from Job where job.JodId = '4990941' ";
jcs,outprint("query is"+query);
I am confused here whether to use executeQuery or executeObjectQuery. As I know that the result is 1, I thought of using executeQuery instead of objectQuery.
jcssession.executeQuery(query,null,long object);
but I am getting the error at this line. Please help
Hi Vishnu,
There are multiple typos in your query. If you want to get the job status, you should consider REL:
Two parameters, one of type Number named JOBID, holding your job id, the other, of type String, holding the following default value:
=Query.getString('select Job.Status from Job where Job.JobId=?', [parameters.JOBID])
This will give you the Status code.
For the record, this is how you use executeQuery, provided your query returns Long's (which is the case here) - note that I highly recommend using the above, much easier:
Here is an example using LongCallBack.
{
//Comment out the following line in your job definition
//create a parameter named MyParameter on the job definition
String MyParameter = "123";
final LongCallBack callback = new LongCallBack(0);
final String QUERY = "select Job.JobDefinition from Job where Job.JobId = ?";
jcsSession.executeQuery(QUERY, new Object[] { new Long(MyParameter) }, callback);
final java.util.List resultWithUniqueIds = callback.getResult();
for (final Iterator itr = resultWithUniqueIds.iterator(); itr.hasNext();)
{
final Long jobDefinitionUniqueId = (Long) itr.next();
//... your code here
jcsOut.println(jobDefinitionUniqueId);
}
}
Regards,
HP
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.