Example: nca_lov_get_item_name

In the following example, each entry in the table called Journals is accessed. The function obj_get_info retrieves the number of rows in the window. A for loop then sets the index i and the function nca_lov_get_item_name retrieves the name value which is then sent to the output. Note that the parameter item_name has been allocated prior to the call to nca_lov_get_item_name.

char num_rows_string[3], item_name[40];
int num_rows, i;
nca_set_window("Journals");
nca_lov_retrieve_items("Journals", 1, 18);
/* Find out how many entries in the "Journals" table there are */
nca_obj_get_info("Journals", "num_rows", num_rows_string);
num_rows = atoi(num_rows_string); /* num_rows holds the number of entries */
/* Iterate through each item */
for (i=1; i<num_rows; ++i) {
     nca_lov_get_item_name("Journals",i, item_name );
     lr_output_message("The name of the item is %s", item_name );
}