Thanks Everyone,

 I found the answer yesterday at night.
 This is my answer :

**********************************************************
fieldsNamesArray and fieldsIdsArray
**********************************************************
Sub main()
 Dim ARserverObject, sessionId
 Set ARserverObject = CreateObject("BMC.ARSystem.Server")
 sessionId = ARserverObject.Login(SERVER_NAME, SERVER_USERNAME, 
SERVER_PASSWORD, "" )
 ' retrieve fields Names and Ids for the schema FORM_NAME
 Dim fieldsArrayList
 Set fieldsArrayList = ARserverObject.GetListField(FORM_NAME )
 fieldsIdsArray = fieldsArrayList.ToArray()
 Set fieldsArrayList = Nothing
 Dim i, ARfieldObject, fieldsNamesArray()
 ReDim fieldsNamesArray(UBound(fieldsIdsArray ) )
 For i = LBound(fieldsIdsArray ) To UBound(fieldsIdsArray )
  fieldsIdsArray(i ) = CLng(fieldsIdsArray(i ) )
  Set ARfieldObject = ARserverObject.GetField(FORM_NAME, fieldsIdsArray(i ) )
  fieldsNamesArray(i ) = ARfieldObject.Name
  WriteLogWarn LogFilePath, 3, NetSendRecipientsFilePath, FORM_NAME & " : 
field[" & fieldsIdsArray(i ) & "] = " & fieldsNamesArray(i )
 Next
 Dim
 ARserverObject.Logout
End Sub
**********************************************************


Best regards.

-----Message d'origine-----
De : Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] 
De la part de Papolu, Appajee
Envoyé : mardi 8 août 2006 08:27
À : [email protected]
Objet : Re: API + VBScript : list of fields in a from

Hi All,

GetFieldNames is not available in the new drops. This is eliminated as the more 
complete implementation of the GetField API function is now available. So to 
achieve what Balu is trying to do, he can do some thing as below:


'********************************************
'*** Code for retrieving field definition ***
'********************************************
Const formName = "User"
Dim server, fieldIds
Set server      = CreateObject("BMC.ARSystem.Server")
server.Login "localhost", "Demo", "", ""
' Get list of fieldIds
Set fieldIds = server.GetListField(formName) ' Iterate over fieldIds to get 
their definitions Dim i, count, fieldId, field count = fieldIds.Count For i = 1 
to count ' THIS WORKS, having problems with For Each
        fieldId = CLng(fieldIds(i-1))
        WScript.Echo "Field : " & fieldId
        Set field = server.GetField(formName,   fieldId)
        WScript.Echo "Field(" & fieldId & ") Name = " & field.Name & ";DataType 
= " & CLng(field.DataType) Next Call server.Logout Set server = Nothing

 
There is also the GetAllFields method which is supposed to do (GetListField & 
get each field definition also) in one shot, so the clients could simply do the 
following:

WScript.Echo "Another way..."
Dim fieldDefs
Set fieldDefs = server.GetAllFields(formName) count = fieldDefs.Keys.Count For 
Each fieldId in fieldDefs.Keys ' PROBLEM HERE (explained below)
        Set field = fieldDefs(fieldId)
        WScript.Echo "Field(" & fieldId & ") Name = " & field.Name & ";DataType 
= " & CLng(field.DataType) Next

However at this time, I am unable to make the above snippet work in VBS; but 
the equivalent in C# does work for sure. The point of error is at the For Each 
statement right at "For Each fieldId in fieldDefs.Keys". I need to look into 
this some more. While users preferably could use the less verbose usage as in 
the second snippet; to avoid the current defect (applicable for VBS usage) - 
they can use the first snippet for now.

Regards
Appajee


-----Original Message-----
From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] 
On Behalf Of Dan Hardy
Sent: Monday, August 07, 2006 11:23 AM
To: [email protected]
Subject: Re: API + VBScript : list of fields in a from

I just checked the docs (although they are for an older version) and there is 
also a GetFieldNames method that returns both the IDs and field names for all 
fields, so that would work also - assuming it's still there in the newer 
version.

Dan

-----Original Message-----
From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] 
On Behalf Of Tim Widowfield
Sent: Monday, August 07, 2006 11:10 AM
To: [email protected]
Subject: Re: API + VBScript : list of fields in a from

I couldn't find a GetListField() method anywhere in the ARSystem .NET help file 
(ARSystem.NET.chm).  Perhaps you were thinking of the Server.GetAllFields() 
method.  Here's a sample from the CHM file: 
 
             Dim fields
            Set fields = server.GetAllFields(formName)
            Dim field
            For Each field In fields
            Next   
 
My brain isn't wired for Visual Basic, so I'll just assume that makes sense.

  
--Tim
http://www.widowfield.com
----- Original Message ----
From: BALU Frédéric
To: [email protected]
Sent: Monday, August 7, 2006 6:51:51 AM
Subject: [ARSLIST] API + VBScript : list of fields in a from 
 
Hello, 
 
 I'm trying to get the list of fields in a form. Could you hel me ? 
 
 Dim ARserverObject
 Set ARserverObject = CreateObject("BMC.ARSystem.Server")
 ARserverObject.Login(SERVER_NAME, SERVER_USERNAME, SERVER_PASSWORD, "" ) ???  
ARserverObject.GetListField(SchemaName ) ??? 
 
Regards,
-- 

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at http://www.wwrug.org

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at http://www.wwrug.org

Reply via email to