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"