Function : Item (Field)

NSFItemInfoNext - Get information about the next item in a note.
----------------------------------------------------------------------------------------------------------

#include <nsfnote.h>

STATUS LNPUBLIC NSFItemInfoNext(
NOTEHANDLE note_handle,
BLOCKID NextItem,
const char far *item_name,
WORD name_len,
BLOCKID far *item_blockid_ptr,
WORD far *value_type_ptr,
BLOCKID far *value_blockid_ptr,
DWORD far *value_len_ptr);

Description :

This function looks for the next item (field) in a note. The function is used primarily to find all the items in a note that have the same name. The function returns a variety of information -- enabling you to access each item's contents.

The BLOCKID values obtained using this function refer to memory within a note. This memory is managed by Domino and Notes, and should not be freed by the application.

Note: The items in a note are maintained in the order that they were added to the note. You cannot depend on this function to obtain items in the same order in which they appear in any form.

Note: To find all the items in a note, use NSFItemScan.

Parameters :

Sample Usage :

/* This code fragment illustrates how to obtain access to a
   number of items in a note which have the same item name.
*/

  num_fields = 0;     /* initialize counter for number of fields
                         found */

  /* get information about a field called RICH_TEXT */

  error = NSFItemInfo(note_handle,
                      "RICH_TEXT",
                      strlen("RICH_TEXT"),
                     &item_blockid,
                      &value_datatype, NULL, NULL);

  if (error)
  {
     printf ("Error:  unable to get info about item 'RICH_TEXT'\n");
    NSFNoteClose (note_handle);
     NSFDbClose(db_handle);
     return (ERR(error));
  }

  printf("Field 'RICH_TEXT' was found.  Type = %s.\n",
          interpret_datatype(value_datatype));
  num_fields++;

  /* get information about additional fields with the
    same name, RICH_TEXT */

  while (TRUE)
  {
     prev_item_blockid = item_blockid;

     error = NSFItemInfoNext(note_handle,
                             prev_item_blockid,
                             "RICH_TEXT",  /* name of item we want
                                              next; obtain items in
                                              in order in note */
                             strlen("RICH_TEXT"),  /* name length */
                             &item_blockid,
                             &value_datatype,
                             &value_blockid,
                             &value_len);

     if (ERR(error) == ERR_ITEM_NOT_FOUND)
     {
         /* NSFItemInfoNext returned ERR_ITEM_NOT_FOUND. */
         printf ("No more items found in note.\n");
         break;
     }
     else if (error)
     {
         printf
          ("Error: unable to get info about next item in note.\n");
         break;
     }

     /* get name of field */

     NSFItemQuery(note_handle,
                  item_blockid,  /* block ID of item to get name of */
                  item_name,      /* name of item returned here */
                  LINEOTEXT,
                  &item_name_len, /* length of name returned here */
                  &item_flags,    /* item flags returned here */
                  &value_datatype,
                  &value_blockid,
                  &value_len);

     /* print name and type of field */

     item_name[item_name_len] = '\0';

     printf ("Field '%s' was found.  Type = %s.\n", item_name,
                         interpret_datatype(value_datatype));
     num_fields++;

 }   /* end of while loop */


 printf("%d fields found.\n", num_fields);


See Also :

NSFItemInfo
----------------------------------------------------------------------------------------------------------