on 06-21-2006 6:03 AM
Hi All,
I'm working on the standard repository SP3_VENDOR so that it will be easier to understand my scenario.
Main table --> Vendors. Field in the Vendors --> Phone Number. Qualified look-up table --> Phone Numbers.
Now, Phone Numbers table has 5 qualifier field
1. Telephone
2. Standard No.
3. Sequence No.
4. Extension
5. Complete No.
and non-qualifier field --> Country.
Hope the scenario is clear.
Now, I'm trying to add one more entry to the "Phone Number " field in already existing Vendor record through JAVA APIs.
I have found out both the record ID for "Vendors" and "Phone Numbers" and changestamp for the main table record.
Code snippet that I'm using here,
<b>QualifiedLinkArray qualifiedLinkArray = new QualifiedLinkArray();
QualifiedLink qualifiedLink = new QualifiedLink();</b>
//set non-qualifier
//get the record id of the lookup table for the non qualifier
<b>int lookupRecordID = getRecordID(<Lookup table name>,<Lookup DF>,<value>);
qualifiedLink.SetLookupID(lookupRecordID);</b> //set qualifier value
//for qualifier fields
<b>Value val = new Value(rec_value);
A2iField field1 = new A2iField(<FieldName>,val);
qualifiedLink.GetQualifiers().Add(field1);</b>
and then the addition to Array and catalogdata.AddQualifiedLinks();
but, I'm getting "StringException: ModifyQualifiedLinks error".
I would like to ask if values for all the qualifier fields needs to be specified(none of them are "required" field). Am I doing something wrong here.
Please suggest,
Thanks and Regards,
Mausam
Message was edited by: Mausam Kakkad
Hi,
Paste the code here.
You might be missing some steps.
Thanks and Regards
Subbu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Subbu,
Thanks for the prompt reply.
The code snippet
QualifiedLinkArray qualifiedLinkArray = new QualifiedLinkArray();
QualifiedLink qualifiedLink = new QualifiedLink();
qualifiedLink.SetLookupID(<ID of the record in Phone number table>);
//I just want to add "Telephone" for now
A2iField field = new A2iField("Telephone", new Value("113"));
qualifiedLink.GetQualifiers().Add(field);
qualifiedLinkArray.Add(qualifiedLink);
int changestamp = 0;
try {
changestamp = rs.GetChangeStampAt(<b><index at which Vendors Record is located></b>); // rs is A2IResultSet object for Vendors.
} catch (StringException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
try {
cd.AddQualifiedLinks("Vendors","Phone Number",<b><Vendors record ID></b>,qualifiedLinkArray,changestamp);
} catch (StringException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
For now, I want to add only Telephone field into the record entry (others are not mendatory fields)
Hope the code is self explanatory.
Thanks and Regards,
Mausam
Hi,
Try this piece.
QualifiedLinkArray qualifiedLinkArray = new QualifiedLinkArray();
QualifiedLink qualifiedLink = new QualifiedLink();
//set non-qualifier
int id = getRecordID("Countries","Name","Afghanistan");
qualifiedLink.SetLookupID(id);
//set qualifier value
Value val = new Value("7322618809");
A2iField sd = new A2iField("Telephone", val);
qualifiedLink.GetQualifiers().Add(sd);
qualifiedLinkArray.Add(qualifiedLink);
// get the main table record id for which you want to add a qualified record
int recordId = getRecordID("Vendors", "Vendor Number", value);
int changeStamp = getChangeStamp("Vendors", recordId);
catalog.AddQualifiedLinks("Vendors", "Phone Number", recordId,qualifiedLinkArray, changeStamp);
Thanks and Regards
Subbu
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.