Thanks, Jarl!
Just one question: there's a mapping->mappingList[i].u.vendor.fieldName that
must be filled as it is the field name to use. There is (I believe) where my
problem starts. How do you fill that property?
// Fields' mappings
if(mapping != NULL) {
mapping->numItems = numItems;
if((mapping->mappingList = (ARFieldMappingStruct
*)calloc(mapping->numItems, sizeof(ARFieldMappingStruct))) == NULL)
return AR_RETURN_ERROR;
mapping->mappingList[0].fieldType = AR_FIELD_REGULAR;
mapping->mappingList[1].fieldType = AR_FIELD_REGULAR;
}
Com os melhores cumprimentos,
Kind regards,
Cordialement,
Paulo Moreira
Compta
Business Solutions
Engenharia
Email : [EMAIL PROTECTED]
Tel. : (+351) 21 413 42 00
Fax : (+351) 21 413 12 20
www : http://www.compta.pt
-----Original Message-----
From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED]
On Behalf Of Jarl Grøneng
Sent: terça-feira, 19 de Fevereiro de 2008 12:24
To: [email protected]
Subject: Re: FW: C API for ARDBC Plug-in
This may work after some changes:
--------------------------------------------------
ARPLUGIN_EXPORT int ARDBCGetMultipleFields(
void *object, // IN; plug-in instance
ARCompoundSchema *schema, // IN; form containing the data ARFieldMappingList
*mapping,// OUT; list of fields
ARFieldLimitList *limit, // OUT; corresponding field limits
ARUnsignedIntList *dataType,// OUT; corresponding data types
ARStatusList *status // OUT; status of the operation
)
{
int numItems = 2;
ARPluginVaLog(logFunc, AR_PLUGIN_LOG_INFO,
"ARDBCGetMultipleFields, ...");
// Fields' mappings
if(mapping != NULL) {
mapping->numItems = numItems;
if((mapping->mappingList = (ARFieldMappingStruct
*)calloc(mapping->numItems, sizeof(ARFieldMappingStruct))) == NULL)
return AR_RETURN_ERROR;
mapping->mappingList[0].fieldType = AR_FIELD_REGULAR;
mapping->mappingList[1].fieldType = AR_FIELD_REGULAR;
}
// Fields' limits
if(limit != NULL) {
limit->numItems = numItems;
if((limit->fieldLimitList = (ARFieldLimitStruct
*)calloc(limit->numItems, sizeof(ARFieldLimitStruct))) == NULL)
return AR_RETURN_ERROR;
// Field 'Request ID'
limit->fieldLimitList[0].dataType = AR_DATA_TYPE_CHAR;
limit->fieldLimitList[0].u.charLimits.maxLength = 15;
limit->fieldLimitList[0].u.charLimits.menuStyle = 2;
limit->fieldLimitList[0].u.charLimits.qbeMatchOperation = 1;
limit->fieldLimitList[0].u.charLimits.charMenu[0] = '\0';
if((limit->fieldLimitList[0].u.charLimits.pattern = (char *) calloc(1,
sizeof(char))) == NULL)
return AR_RETURN_ERROR;
limit->fieldLimitList[0].u.charLimits.pattern[0] = '\0';
limit->fieldLimitList[0].u.charLimits.fullTextOptions = 0;
// Field 'name'
limit->fieldLimitList[1].dataType = AR_DATA_TYPE_CHAR;
limit->fieldLimitList[1].u.charLimits.maxLength = 254;
limit->fieldLimitList[1].u.charLimits.menuStyle = 2;
limit->fieldLimitList[1].u.charLimits.qbeMatchOperation = 1;
limit->fieldLimitList[1].u.charLimits.charMenu[0] = '\0';
if((limit->fieldLimitList[1].u.charLimits.pattern = (char *) calloc(1,
sizeof(char))) == NULL)
return AR_RETURN_ERROR;
limit->fieldLimitList[1].u.charLimits.pattern[0] = '\0';
limit->fieldLimitList[1].u.charLimits.fullTextOptions = 0;
}
// Fields' data types
if(dataType != NULL) {
dataType->numItems = numItems;
if((dataType->intList = (unsigned int *)calloc(dataType->numItems,
sizeof(unsigned int))) == NULL)
return AR_RETURN_ERROR;
dataType->intList[0] = AR_DATA_TYPE_CHAR;
dataType->intList[1] = AR_DATA_TYPE_CHAR;
}
if (status != NULL)
memset(status, 0, sizeof(status));
return AR_RETURN_OK;
}
------------------------------------------
On Feb 19, 2008 11:02 AM, Paulo Moreira <[EMAIL PROTECTED]> wrote:
> Hello,
>
> First of all, thank you for your reply.
> I really *don't* want to support everything, believe me! :) If it is
> such a headache to write a test plugin, I really believe it would be a
> nightmare to write the whole thing....
> My final goal is to create an ardbc plugin to have certain search fields and
> a method to search a FileNet database.
> But for now, I'm just trying to make a test plugin using the C skeleton file
> and implementing a dummy "ARDBCGetMultipleFields" method on it.
> The sample I'm using as a guide is "getemployeedata.c" that I found on BMC
> site, but it doesn't work very well for me, as you can see by my previous
> mail.
>
>
> Kind regards,
> Paulo Moreira
>
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList)
> [mailto:[EMAIL PROTECTED] On Behalf Of Misi Mladoniczky
> Sent: terça-feira, 19 de Fevereiro de 2008 7:54
> To: [email protected]
> Subject: Re: FW: C API for ARDBC Plug-in
>
> Hi,
>
> To write a general ARDBC-plugin that supports everything, is quite a task.
>
> You have problems of mapping forms, field and datatypes, as well as the nice
> ARQualifierStruct into something you can use against your external data
> source.
>
> If you limit the functionality to a few specific things (forms/fields) and
> also limit the search capabilities, it is easier.
>
> Best Regards - Misi, RRR AB, http://rrr.se
>
> > Hello all,
> >
> >
> >
> > Can someone please provide me with some real-life samples on how to
> > (properly) write a C ARDBC Plug-in for Remedy (I've also tried
> > getemployeedata.c) ?
> >
> > So far I've read the C-API-Ref-710, used the ardbcskl.c and headers
> > from the samples directory and implemented the ARDBCGetListSchemas
> > method successfully.
> >
> > I'm having trouble implementing the ARDBCGetMultipleFields method,
> > which is not showing all the fields I insert to the array
> > mapping->mappingList. Only the first one is shown.
> >
> >
> >
> > Please find below the source I'm trying to use:
> >
> >
> >
> > ARPLUGIN_EXPORT int ARDBCGetMultipleFields(
> >
> > void *object, /* IN; plug-in instance */
> >
> > ARCompoundSchema *schema, /* IN; form containing the data */
> >
> > ARFieldMappingList *mapping,/* OUT; list of fields */
> >
> > ARFieldLimitList *limit, /* OUT; corresponding field limits */
> >
> > ARUnsignedIntList *dataType,/* OUT; corresponding data types */
> >
> > ARStatusList *status /* OUT; status of the operation */
> >
> > )
> >
> > {
> >
> > FILE * pFile;
> >
> > pFile = fopen ("myfile.txt","a");
> >
> >
> >
> > if (schema->schemaType == AR_SCHEMA_VENDOR &&
> >
> > strcmp(schema->u.vendor.tableName, FORM_NAME) == 0)
> >
> > {
> >
> > mapping->numItems = 3;
> >
> >
> >
> > mapping->mappingList =
> >
> > (ARFieldMappingStruct *)
> > malloc(sizeof(ARFieldMappingStruct)
> > *
> >
> > mapping->numItems);
> >
> > if (mapping->mappingList == NULL) return AR_RETURN_ERROR;
> >
> >
> >
> > mapping->mappingList[0].fieldType = AR_FIELD_VENDOR;
> >
> > strcpy(mapping->mappingList[0].u.vendor.fieldName, "file_id");
> > /* this is shown OK */
> >
> > mapping->mappingList[1].fieldType = AR_FIELD_VENDOR;
> >
> > strcpy(mapping->mappingList[1].u.vendor.fieldName,
> > "file_name");
> > /* this is not */
> >
> > mapping->mappingList[2].fieldType = AR_FIELD_VENDOR;
> >
> > strcpy(mapping->mappingList[2].u.vendor.fieldName,
> > "file_date");
> >
> >
> >
> > if (pFile!=NULL)
> >
> > {
> >
> > fprintf (pFile, "-//-\r\n");
> >
> > fprintf (pFile, "%s\r\n",
> > mapping->mappingList[0].u.vendor.fieldName);
> >
> > fprintf (pFile, "%s\r\n",
> > mapping->mappingList[1].u.vendor.fieldName);
> >
> > fprintf (pFile, "%s\r\n",
> > mapping->mappingList[2].u.vendor.fieldName);
> >
> >
> >
> > /* all these fields appear filled in on the log
> > file I'm creating at runtime */
> >
> > }
> >
> >
> >
> > limit->numItems = 3;
> >
> >
> >
> > limit->fieldLimitList =
> >
> > (ARFieldLimitStruct *) calloc(limit->numItems,
> >
> > sizeof(ARFieldLimitStruct));
> >
> >
> >
> > if (limit->fieldLimitList == NULL) return AR_RETURN_ERROR;
> >
> >
> >
> > limit->fieldLimitList[0].dataType = AR_DATA_TYPE_CHAR;
> >
> > limit->fieldLimitList[0].u.charLimits.maxLength = 20;
> >
> > limit->fieldLimitList[0].u.charLimits.menuStyle =
> > AR_MENU_APPEND;
> >
> > limit->fieldLimitList[0].u.charLimits.qbeMatchOperation =
> > AR_QBE_MATCH_ANYWHERE;
> >
> > limit->fieldLimitList[0].u.charLimits.fullTextOptions =
> > AR_FULLTEXT_OPTIONS_NONE;
> >
> >
> >
> > /* from this point on, nothing is recognized on Remedy, but is
> > show on the log file (?) */
> >
> >
> >
> > limit->fieldLimitList[1].dataType = AR_DATA_TYPE_CHAR;
> >
> > limit->fieldLimitList[1].u.charLimits.maxLength = 21;
> >
> > limit->fieldLimitList[1].u.charLimits.menuStyle =
> > AR_MENU_APPEND;
> >
> > limit->fieldLimitList[1].u.charLimits.qbeMatchOperation =
> > AR_QBE_MATCH_ANYWHERE;
> >
> > limit->fieldLimitList[1].u.charLimits.fullTextOptions =
> > AR_FULLTEXT_OPTIONS_NONE;
> >
> > limit->fieldLimitList[2].dataType = AR_DATA_TYPE_CHAR;
> >
> > limit->fieldLimitList[2].u.charLimits.maxLength = 22;
> >
> > limit->fieldLimitList[2].u.charLimits.menuStyle =
> > AR_MENU_APPEND;
> >
> > limit->fieldLimitList[2].u.charLimits.qbeMatchOperation =
> > AR_QBE_MATCH_ANYWHERE;
> >
> > limit->fieldLimitList[2].u.charLimits.fullTextOptions =
> > AR_FULLTEXT_OPTIONS_NONE;
> >
> >
> >
> > if (pFile!=NULL)
> >
> > {
> >
> > fprintf (pFile, "---\r\n");
> >
> > fprintf (pFile, "%d\r\n",
> > limit->fieldLimitList[1].dataType);
> >
> > fprintf (pFile, "%d\r\n",
> > limit->fieldLimitList[1].u.charLimits.maxLength);
> >
> > fprintf (pFile, "%d\r\n",
> > limit->fieldLimitList[1].u.charLimits.menuStyle);
> >
> > }
> >
> >
> >
> > /* fill the data type list */
> >
> > dataType->numItems = 3;
> >
> >
> >
> > dataType->intList =
> >
> > (unsigned int *) malloc(sizeof(unsigned) *
> > dataType->numItems);
> >
> >
> >
> > if (dataType->intList == NULL) return AR_RETURN_ERROR;
> >
> >
> >
> > dataType->intList[0] = AR_DATA_TYPE_CHAR;
> >
> > dataType->intList[1] = AR_DATA_TYPE_CHAR;
> >
> > dataType->intList[2] = AR_DATA_TYPE_CHAR;
> >
> >
> >
> > if (pFile!=NULL)
> >
> > {
> >
> > fprintf (pFile, "---\r\n");
> >
> > fprintf (pFile, "%d\r\n", dataType->intList[0]);
> >
> > fprintf (pFile, "%d\r\n", dataType->intList[1]);
> >
> > fprintf (pFile, "%d\r\n", dataType->intList[2]);
> >
> > fclose (pFile);
> >
> > }
> >
> > }
> >
> >
> >
> > return AR_RETURN_OK;
> >
> > }
> >
> >
> >
> > Kind regards,
> >
> > Paulo Moreira
> >
> >
> > ____________________________________________________________________
> > __ _________ UNSUBSCRIBE or access ARSlist Archives at
> > www.arslist.org Platinum Sponsor: www.rmsportal.com ARSlist: "Where
> > the Answers Are"
> >
> > --
> > This message was scanned by ESVA and is believed to be clean.
> >
> >
>
> ______________________________________________________________________
> _________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"
>
> ______________________________________________________________________
> _________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"
>
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org Platinum Sponsor:
www.rmsportal.com ARSlist: "Where the Answers Are"
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"