adTempus 2.0 API - ASP

smp (34 posts)
October 29, 2008 02:46 PM
Accepted Answer
Hi. I was able to fight my way through developing a simple web interface with ASP using the Arcana API. The web interface provided some rudimentary control over scheduled jobs.
 
I'm in the process of trying to migrate that ASP code to adTempus 2.x, but I'm having difficulty understanding the API documentation. Because I am not a programmer, I get lost in all the object/interfaces/classes jargon.
 
 
I don't quite understand what the arguments are for the GetObjectsWhere method. From the doc it appears I should be using "IObjectRequestFilter", but I can't figure out how the doc of that "interface" translates into ASP/vbscript:
 
set objADTempus = CreateObject("ADTempus.Application")
set objScheduler = objADTempus.Connect("","")
set objJob = objScheduler.GetObjectsWhere("SELECT * from job where name=bogus_name", 0, true)
 
This ends with a "Type mismatch: 'GetObjectsWhere'" error.
 
Can someone please provide me with simple ASP/vbscript code which will allow me to select a particular job based on the known job name?
J.D. Staff (46 posts)
October 30, 2008 08:43 AM
Accepted Answer
If you are just now migrating from the Arcana Scheduler (if I understand correctly), you should strongly consider going to adTempus 3.0 instead of 2.1. Why migrate to a version that's already obsolete?

There is a rudimentary Web interface available for adTempus 2.1 here, which is built using classic ASP using VBScript. You might be able to use that as a starting point. There is a nicer Web interface for adTempus 3.0 here; it's built with ASP.NET.

There is an example in the API documentation (here) that shows how to get a job by name.

The GetObjectsWhere method you are trying to use does not accept a SQL statement directly; you must pass an IObjectRequestFilter interface to an object that provides the selection criteria. This is tough to do in ASP because of the limitations of VBScript; it's easier to use the approach shown in the example cited above. The 3.0 API documentation has an example that shows how to use GetObjectsWhere to get jobs by name in ASP.NET (here).
smp (34 posts)
October 30, 2008 11:30 AM
Accepted Answer
Your question of why we are moving to 2.1 instead of 3.0 is a good and legitimate one. The answer is related to accounting - not for technical reasons.
 
I have been using the example in the 2.0 API doc you referenced. But when I try and translate that example into something else, I run into the stumbling block of not being able to decipher the API documentation. For example, I can see that GetObjectsForClass is a method, which takes ClassIDEnum.CID_Job as an argument. But I can't get my arms around, even after reading the doc, is what the structure of that argument is, or how I build or pass different arguments. This is obviously a limitation of my programming knowledge, which also limits my ability to understand what it really means to be "build with ASP.NET" versus "classic ASP". To me, ASP is just vbscript embedded in HTML. And I understand vbscript, so classic ASP wasn't that difficult. But I don't know how that compares with ASP.NET.
 
I'm just really looking for more examples at this point, and hopefully your references will help. Thanks for your response.
smp (34 posts)
October 30, 2008 11:55 AM
Accepted Answer
How portable is code written for 2.0 after an upgrade to 3.0?
J.D. Staff (46 posts)
October 30, 2008 01:55 PM
Accepted Answer
The CID argument to that method is a ClassIDEnum value, which is essentially a constant. If you add a reference to the adTempus type library to your ASP page, this should cause the constants to be defined:
<!-- METADATA TYPE="typelib" FILE="c:\program files\arcana development\adtempus\adtempus.dll"-->

If you get an error back from the method saying that you're requesting an invalid class, that means the script isn't picking up the type library properly and the constant isn't defined. If you can't get the type library import to work you can use the integer value instead of the enumeration. The numeric values are given in the ClassIDEnum help topic. For example, use 1 for CID_Job.

The API did have some "breaking" changes between 2.x and 3.0 (documented here). But for the basic stuff you are (presumably) doing, the changes to move to 3.0 should be minimal.



smp (34 posts)
October 30, 2008 03:54 PM
Accepted Answer

Would you be willing to provide an example using IObjectRequestFilter? Maybe that's all I need to get me started...

J.D. Staff (46 posts)
October 30, 2008 04:07 PM
Accepted Answer
The example I linked to earlier from the 3.0 documentation shows an example of using IObjectRequestFilter. But when I said earlier that it would be tough to do in VBScript I should have said "if you can do it in VBScript I don't know how." I don't think VBScript allows you to create classes that implement interfaces, though I haven't worked with newer versions of the language.

You are better off using the example from the 2.0 documentation. If it's not working as written, replace "ClassIDEnum.CID_Job" with the numeric value 1.

Replies are disabled for this topic.