GetFieldid with 7.1 Java API

2007-09-20 Thread Jarl Grøneng
Hi,

Trying to use the Java api to retrieve the fieldid, but does not get it.

I have the formname and the fieldname (not fieldlabel).

Anyone?

Regards,
Jarl

___
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:Where the 
Answers Are


Re: GetFieldid with 7.1 Java API

2007-09-20 Thread Steynberg, Calman
Jarl,

If you only have the field name, then you need to get all the fields from the 
form and iterate over them until you find the field you want.

The code below shows how.

Calman

import java.text.MessageFormat;
import java.util.List;

import com.bmc.arsys.api.ARServerUser;
import com.bmc.arsys.api.Field;

public class FindFieldByName {

public static void main(String[] args) throws Exception {

ARServerUser context = new ARServerUser(Demo, , , localhost);
context.login();

ListField fields = context.getListFieldObjects(Sample:Classes);

for (Field field : fields) {
if (field.getName().equals(Spell Check)) {
int fieldId = field.getFieldID();
// Use Integer.toString() to print field id to prevent locale 
formatting
System.out.println(MessageFormat.format(Field ID of {0} is 
{1}, field.getName(), Integer
.toString(fieldId)));
break;
}
}

}
}

-Original Message-
From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] 
On Behalf Of Jarl Grøneng
Sent: Thursday, September 20, 2007 11:15 AM
To: arslist@ARSLIST.ORG
Subject: GetFieldid with 7.1 Java API

Hi,

Trying to use the Java api to retrieve the fieldid, but does not get it.

I have the formname and the fieldname (not fieldlabel).

Anyone?

Regards,
Jarl

___
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:Where the 
Answers Are

___
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:Where the 
Answers Are


Re: GetFieldid with 7.1 Java API

2007-09-20 Thread Jarl Grøneng
Calman,

Thanks a lot. I did hope for an easy way, but this helps me out.

Thanks again,
Jarl



On 9/20/07, Steynberg, Calman [EMAIL PROTECTED] wrote:
 Jarl,

 If you only have the field name, then you need to get all the fields from the 
 form and iterate over them until you find the field you want.

 The code below shows how.

 Calman

 import java.text.MessageFormat;
 import java.util.List;

 import com.bmc.arsys.api.ARServerUser;
 import com.bmc.arsys.api.Field;

 public class FindFieldByName {

 public static void main(String[] args) throws Exception {

 ARServerUser context = new ARServerUser(Demo, , , localhost);
 context.login();

 ListField fields = context.getListFieldObjects(Sample:Classes);

 for (Field field : fields) {
 if (field.getName().equals(Spell Check)) {
 int fieldId = field.getFieldID();
 // Use Integer.toString() to print field id to prevent locale 
 formatting
 System.out.println(MessageFormat.format(Field ID of {0} is 
 {1}, field.getName(), Integer
 .toString(fieldId)));
 break;
 }
 }

 }
 }

 -Original Message-
 From: Action Request System discussion list(ARSList) [mailto:[EMAIL 
 PROTECTED] On Behalf Of Jarl Grøneng
 Sent: Thursday, September 20, 2007 11:15 AM
 To: arslist@ARSLIST.ORG
 Subject: GetFieldid with 7.1 Java API

 Hi,

 Trying to use the Java api to retrieve the fieldid, but does not get it.

 I have the formname and the fieldname (not fieldlabel).

 Anyone?

 Regards,
 Jarl

 ___
 UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:Where the 
 Answers Are

 ___
 UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:Where the 
 Answers Are


___
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:Where the 
Answers Are