reciprocity00
IS-IT--Management
I am trying to get all the standard job#, origpriority and mainttype for a giving mainttype (e.g.MF). The script I wrote is just giving me the first 20 results (much like the screen dataset in MSQ690). Does anyone know to scroll through the blocks for both retrieval and updating (I would like to update the origpriorty of the retrieved records).
Here is my VBA code snippet:
Set RetrieveSJBlock = gobjMIMS.Blocks.New
With RetrieveSJBlock.Requests.New
.AddFieldNameValue MIMSX_FLAG_SERVICE, "STANDARDJOB.Retrieve"
.AddFieldNameValue MIMSX_FLAG_REPLYLIST, "StandardJob,MaintType,OrigPriority"
With .Instances.New
.AddFieldNameValue "MaintType", "MF"
End With
End With
On Error Resume Next
Set RetrieveSJReply = RetrieveSJBlock.Send
Set sjSheet = Worksheets("StandardJobs")
j = 2
m = 0
l = 0
l = RetrieveSJReply.Requests.Count
m = RetrieveSJReply.Requests(1).Instances.Count
With sjSheet
For x = 1 To m
.Cells(j, 1) = RetrieveSJReply.Requests(1).Instances(x).Fields("StandardJob")
.Cells(j, 2) = RetrieveSJReply.Requests(1).Instances(x).Fields("MaintType")
.Cells(j, 3) = RetrieveSJReply.Requests(1).Instances(x).Fields("OrigPriority")
j = j + 1
Next
End With
Here is my VBA code snippet:
Set RetrieveSJBlock = gobjMIMS.Blocks.New
With RetrieveSJBlock.Requests.New
.AddFieldNameValue MIMSX_FLAG_SERVICE, "STANDARDJOB.Retrieve"
.AddFieldNameValue MIMSX_FLAG_REPLYLIST, "StandardJob,MaintType,OrigPriority"
With .Instances.New
.AddFieldNameValue "MaintType", "MF"
End With
End With
On Error Resume Next
Set RetrieveSJReply = RetrieveSJBlock.Send
Set sjSheet = Worksheets("StandardJobs")
j = 2
m = 0
l = 0
l = RetrieveSJReply.Requests.Count
m = RetrieveSJReply.Requests(1).Instances.Count
With sjSheet
For x = 1 To m
.Cells(j, 1) = RetrieveSJReply.Requests(1).Instances(x).Fields("StandardJob")
.Cells(j, 2) = RetrieveSJReply.Requests(1).Instances(x).Fields("MaintType")
.Cells(j, 3) = RetrieveSJReply.Requests(1).Instances(x).Fields("OrigPriority")
j = j + 1
Next
End With