iterating items |
Post Reply |
Author | |
adico
Groupie Joined: 20 April 2006 Location: United States Status: Offline Points: 23 |
Post Options
Thanks(0)
Posted: 28 April 2006 at 12:04am |
i am looking for a good example (vc++) on how to iterate through every single item(column) on a record (row).
i can get the row, but i want to scan every item & find out which item is empty (" "). Thanx in advance |
|
I am not my memories...I am my dreams!
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
If you have a record pointer, you can iterate it in a very simple manner:
-- WBR, Serge |
|
adico
Groupie Joined: 20 April 2006 Location: United States Status: Offline Points: 23 |
Post Options
Thanks(0)
|
Sserge, thanx for your reply. However it doesn't seem to do what I want. Here is the code:
CXTPReportRecordItem* pItem = NULL; CXTPReportRecord* pRecord = (CXTPReportRecord*)m_wndReport.GetRecords(); int nItemCnt = pRecord->GetItemCount(); for(int i = 0; i < nItemCnt; i++) { pItem = pRecord->GetItem(i); if(pItem) // IT NEVER GETS INSIDE HERE { ASSERT(pItem->GetCaption(NULL).IsEmpty()); } } it never gets inside the if(pItem) statement. am i missing something? Basically this is what I want to do: when the user clicks on a button, i want to get a total count of all the rows in the report. then starting with the first row, i want to iterate thru all the items & find out if there are any empty items. if so, i want to break out of the look & set focus (maybe change the cell color) to the first empty item. |
|
I am not my memories...I am my dreams!
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Your code above has an error. GetRecords() returns a collection of records, not just a single one. So far, to iterate all records and then items it would be:
ps: by your description, you probably need to iterate ReportRows, and only then take and check a Record from a Row. -- WBR, Serge |
|
adico
Groupie Joined: 20 April 2006 Location: United States Status: Offline Points: 23 |
Post Options
Thanks(0)
|
thanx sserge,
this does what i want (after some minor modifications). could you elaborate (maybe provide an example) on what you mean by iterating ReportRows? thnx |
|
I am not my memories...I am my dreams!
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
No problem, firstly look at help files to see the difference between Record and a Row.
Iterating difference is in their order. If you iterate Records, you'll take them in the order like you were adding them into the control. If you iterate Rows, they go in order like they're displayed. Here is the example (add there NULL checks, etc):
-- WBR, Serge |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |