Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

    I have created a record with 3 fields Name, Phone, Address.

Name field has subfields like FIRSTNAME, LASTNAME & FULLNAME.

Phone (CELL, WORK & HOME).

Address(CITY, STATE, STREET).

I am using  pim_IContactsRecord_GetNumChildren(pIContactsRec, "/", &fieldCount);

to get number of fields in the record.

Is there any functions to get field names like Name, Phone, Address.

 

Thanks.

Use pim_IContactsRecord_GetChildName(). See API reference for usage.

Use pim_IContactsRecord_GetChildName(). See API reference for usage.

thanks for ur reply....
I have added one record like this,
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/Type",L"GENERIC");
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/Value",L"#25");
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/City",L"Bangalore");
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/State",L"Karnataka");
 
Is there any way to get subfield values like Type, Value, City, and State.
Rt now i am using
Result = pim_IContactsRecord_GetChildName( pIContactsRec, TempBuf,   1, "Address/1", nLenReq,  NULL);
its returning Address/.
I think it may be a filter problem ,not sure. please help its urgent.
 

thanks for ur reply....
I have added one record like this,
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/Type",L"GENERIC");
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/Value",L"#25");
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/City",L"Bangalore");
Result =pim_IContactsRecord_SetFieldValue(pIContactsRec,"Address/1/State",L"Karnataka");
 
Is there any way to get subfield values like Type, Value, City, and State.
Rt now i am using
Result = pim_IContactsRecord_GetChildName( pIContactsRec, TempBuf,   1, "Address/1", nLenReq,  NULL);
its returning Address/.
I think it may be a filter problem ,not sure. please help its urgent.
 

There is no direct API, but you can iterate it like below code.
  nErr = pim_IContactsRecord_GetNumChildren(pimcontrec, Key, &nNumFields);
   if (AEE_SUCCESS == nErr) {      while ((AEE_SUCCESS == nErr) && (0 < nNumFields) && !bFound) {         char *pszChildName = NULL;         int nChildNameLen;
         nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, NULL, 0, &nChildNameLen);         if (AEE_SUCCESS == nErr) {            nErr = IEnv_ErrMalloc(me->piEnv, nChildNameLen, (void**)&pszChildName);            if (AEE_SUCCESS == nErr) {               nErr = pim_IContactsRecord_GetChildName(pimcontrec, pszKey, nNumFields, pszChildName, nChildNameLen, NULL);               if (AEE_SUCCESS == nErr) {                  if (!std_strcmp(pszFieldName, pszChildName)) {                     bFound = TRUE;                  }               }
               IEnv_Free(me->piEnv, pszChildName);               pszChildName = NULL;            }         } 

There is no direct API, but you can iterate it like below code.
  nErr = pim_IContactsRecord_GetNumChildren(pimcontrec, Key, &nNumFields);
   if (AEE_SUCCESS == nErr) {      while ((AEE_SUCCESS == nErr) && (0 < nNumFields) && !bFound) {         char *pszChildName = NULL;         int nChildNameLen;
         nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, NULL, 0, &nChildNameLen);         if (AEE_SUCCESS == nErr) {            nErr = IEnv_ErrMalloc(me->piEnv, nChildNameLen, (void**)&pszChildName);            if (AEE_SUCCESS == nErr) {               nErr = pim_IContactsRecord_GetChildName(pimcontrec, pszKey, nNumFields, pszChildName, nChildNameLen, NULL);               if (AEE_SUCCESS == nErr) {                  if (!std_strcmp(pszFieldName, pszChildName)) {                     bFound = TRUE;                  }               }
               IEnv_Free(me->piEnv, pszChildName);               pszChildName = NULL;            }         } 

There is no direct API, but you can iterate it like below code.
nErr = pim_IContactsRecord_GetNumChildren(pimcontrec, Key, &nNumFields);

if (AEE_SUCCESS == nErr) {
while ((AEE_SUCCESS == nErr) && (0 < nNumFields) && !bFound) {
char *pszChildName = NULL;
int nChildNameLen;

nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, NULL, 0, &nChildNameLen);
if (AEE_SUCCESS == nErr) {
nErr = IEnv_ErrMalloc(me->piEnv, nChildNameLen, (void**)&pszChildName);
if (AEE_SUCCESS == nErr) {
nErr = pim_IContactsRecord_GetChildName(pimcontrec, pszKey, nNumFields, pszChildName, nChildNameLen, NULL);
if (AEE_SUCCESS == nErr) {
if (!std_strcmp(pszFieldName, pszChildName)) {
bFound = TRUE;
}
}

IEnv_Free(me->piEnv, pszChildName);
pszChildName = NULL;
}
}

There is no direct API, but you can iterate it like below code.
nErr = pim_IContactsRecord_GetNumChildren(pimcontrec, Key, &nNumFields);

if (AEE_SUCCESS == nErr) {
while ((AEE_SUCCESS == nErr) && (0 < nNumFields) && !bFound) {
char *pszChildName = NULL;
int nChildNameLen;

nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, NULL, 0, &nChildNameLen);
if (AEE_SUCCESS == nErr) {
nErr = IEnv_ErrMalloc(me->piEnv, nChildNameLen, (void**)&pszChildName);
if (AEE_SUCCESS == nErr) {
nErr = pim_IContactsRecord_GetChildName(pimcontrec, pszKey, nNumFields, pszChildName, nChildNameLen, NULL);
if (AEE_SUCCESS == nErr) {
if (!std_strcmp(pszFieldName, pszChildName)) {
bFound = TRUE;
}
}

IEnv_Free(me->piEnv, pszChildName);
pszChildName = NULL;
}
}

Thanks smahesh...
plz can u tell me wat r filters ur passing here... i mean Key and pszKey values..

Thanks smahesh...
plz can u tell me wat r filters ur passing here... i mean Key and pszKey values..

Key is the filter, you may want to look for in the key (for ex. "/" in "Phone/1/XYZ"). I above code replace pszKey with Key like below
nErr = pim_IContactsRecord_GetNumChildren(pimcontrec, Key, &nNumFields);

if (AEE_SUCCESS == nErr) {
while ((AEE_SUCCESS == nErr) && (0 < nNumFields) && !bFound) {
char *pszChildName = NULL;
int nChildNameLen;

nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, NULL, 0, &nChildNameLen);
if (AEE_SUCCESS == nErr) {
nErr = IEnv_ErrMalloc(me->piEnv, nChildNameLen, (void**)&pszChildName);
if (AEE_SUCCESS == nErr) {
nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, pszChildName, nChildNameLen, NULL);
if (AEE_SUCCESS == nErr) {
if (!std_strcmp(pszFieldName, pszChildName)) {
bFound = TRUE;
}
}

IEnv_Free(me->piEnv, pszChildName);
pszChildName = NULL;
}
}

Key is the filter, you may want to look for in the key (for ex. "/" in "Phone/1/XYZ"). I above code replace pszKey with Key like below
nErr = pim_IContactsRecord_GetNumChildren(pimcontrec, Key, &nNumFields);

if (AEE_SUCCESS == nErr) {
while ((AEE_SUCCESS == nErr) && (0 < nNumFields) && !bFound) {
char *pszChildName = NULL;
int nChildNameLen;

nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, NULL, 0, &nChildNameLen);
if (AEE_SUCCESS == nErr) {
nErr = IEnv_ErrMalloc(me->piEnv, nChildNameLen, (void**)&pszChildName);
if (AEE_SUCCESS == nErr) {
nErr = pim_IContactsRecord_GetChildName(pimcontrec, Key, nNumFields, pszChildName, nChildNameLen, NULL);
if (AEE_SUCCESS == nErr) {
if (!std_strcmp(pszFieldName, pszChildName)) {
bFound = TRUE;
}
}

IEnv_Free(me->piEnv, pszChildName);
pszChildName = NULL;
}
}

ok Thanks ...
Is it possible to get field ID in BMP like Brew?
if yes How??

ok Thanks ...
Is it possible to get field ID in BMP like Brew?
if yes How??

The same would work on BrewMP as well. Let me know How are you doing in Brew?

The same would work on BrewMP as well. Let me know How are you doing in Brew?

Hi smahesh,
    In brew initially we are adding field ID's to all fields. we r using
IADDRREC_GetField() to get field info.

Hi smahesh,
    In brew initially we are adding field ID's to all fields. we r using
IADDRREC_GetField() to get field info.

IADDREC is deprecated in BrewMP, Use the pim_IContacts interface instead

IADDREC is deprecated in BrewMP, Use the pim_IContacts interface instead