Counts the number of occurrences in a data itemint sm_get_bundle_occur_count(char * bundle_name, int item_no);
- The name of the bundle. Supply
NULLor empty string to specify the unnamed bundle.
- The bundle offset of the item whose occurrences you want to count. Each data item is identified by its offset within the bundle, where the first data item has an offset value of 1.
sm_get_bundle_occur_countcounts the number of occurrences in the specified data item. Use this function to get the number of occurrences in a data item. This lets you supply the correct argument to sm_get_bundle_data to read the entire contents of the item into a buffer. You can also use the function's return value to set a counter for successive reads from this buffer into a target field.
/* read data occurrences from a bundle data item
into a field
char *occur_data, array_data;
int num_occurs, emp_name_occur;
emp_name_occurs = 1;
/*count the number of occurrences in the data item */
num_occurs = sm_get_bundle_occur_count("myBundle", 1);
/*get item data and put into field*/
for (occur = 1;occur <= num_occurs;occur++, emp_name_occur++)