Print Page | Close Window

Report Questions

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1020
Printed Date: 23 November 2024 at 7:38am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Report Questions
Posted By: Maui
Subject: Report Questions
Date Posted: 05 August 2004 at 6:06am

I have some questions regarding the ading and editing of cell data using the report control that I am hoping someone can help with.

In your other controls you have the theme of being able to create an item and assign it your own id so you later access it.
eg with the Docking pane I have used code like this
Public Const ID_PANE_MENU = 501
Set A = .CreatePane(ID_PANE_MENU, 200, 120, DockLeftOf)

eg with the Control bars
Public Const ID_FILE_OPEN = 101
Set Control = .Add(xtpControlButton, ID_FILE_OPEN, "&Open")

So, naturally when it came time to use the report control I assumed you would have the same theme and I put this code in my app to create some columns.

Public Const COLUMN_DATEISSUED = 101
Set Column = .Columns.Add(COLUMN_DATEISSUED, "Date Issued", 180, True)

This works fine and I can see that .Columns.Find would work the same as your other controls but I am having trouble finding and editing cell data and I cant see how our user defined IDs can help.

My problem occured when I tried to add data to the report.
I used this code and nothing happened.
Set Item = Record.AddItem("Test")
Grid1.Populate

I eventually found out that you arent free to define your own IDs. You have to make your column identifiers sequential and 0 based. eg I had to change
Public Const COLUMN_DATEISSUED = 101
to
Public Const COLUMN_DATEISSUED = 0
and I could add data to my grid.

This brings me to my questions:

1. Why has this methodology changed? We could have our own unique identifiers before, but now we have to have them 0 based. This isnt really that big a problem but it is different from all the other controls you do so I am wondering why?

2. If the AddItem method uses the current column Index rather than our own defined ID's then how do we know what column you are adding into? or rather ammending? Do we have to loop across columns to get to the item we want to add / ammend? The sample app doesnt really show this as it just creates Items and adds them in sequentially. It doesnt really show how its position is kept track of. Wouldnt it have been clearer to do it like this....
Set Item = Record.AddItem("Test",COLUMN_DATEISSUED) ???

3. Could you provide an example to show how to change the value in a cell please.

Thanks




Replies:
Posted By: ianp
Date Posted: 05 August 2004 at 6:41am

Hi Maui

In response to your third question, the Report Control sample the following code will change value of the 4th item in the 3rd record. If you change the group, column or sort orders, then try the code again, the same item in the same record will be changed:

With wndReportControl
  .Records(3).Item(4).Value = "Test"
  .Redraw   'possibly not required
End with

I'm afraid I can't answer the first two questions for you, but remember, this is the first release of the control. The other controls were quickly added to and improved based on suggestions in the forums...



Posted By: SuperMario
Date Posted: 05 August 2004 at 6:54am
I will attempt to answer 2.

You can use the Tag property to assign a value or ID to each Record if you like.  When adding items to a Record, you have to add the items in the same order that the Columns were added, even if the column is not visible, or the column order has changed, you still add the items in the same order without skipping any.  If the item is blank, then add a item with "" as a value.  So that is how you know which collumn the item is being added to.

For number one, if you take a look at the help file you will see that it states how the columns use the Index and ItemIndex properties.  I think you will find the ReportControl help more to your liking.  I've read your other post regarding the help and I think the ReportControl help is closer to what you would expect?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net