Print Page | Close Window

How to read userselected constraints

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=4044
Printed Date: 21 November 2024 at 4:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to read userselected constraints
Posted By: cmaxmedia
Subject: How to read userselected constraints
Date Posted: 22 April 2006 at 6:49am

If I have added a contstraint to the first column of the reportcontrol like this:

    Column.EditOptions.AddComboButton
    Column.EditOptions.Constraints.Add "Phone", 1
    Column.EditOptions.Constraints.Add "Email", 2
    Column.EditOptions.Constraints.Add "Homepage", 3


now i want to get the user selection for an item in the reportcontrol-list with about 15 lines.

for reading the user value i am working like this

Private Sub ReportControl_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)

   'this part works fine, if not constraints exists in column object
   Msgbox Item.Caption

   'now i'd like to read the user input, when a Constraints Dropdowncombo exists like
   Msgbox Item.SelectedConstraints.Value ?

End Sub

Kind regards




Replies:
Posted By: sserge
Date Posted: 24 April 2006 at 7:16am
Hi,

Iterate editing constraints you can in a following way, depending whether you set them for a column or for an item:

Dim c As ReportRecordItemConstraint
For Each c In Item.EditOptions.Constraints ' or wndReport.Columns(column_index).EditOptions.Constraints
    Debug.Print c.Caption
Next


--
WBR,
Serge


Posted By: cmaxmedia
Date Posted: 24 April 2006 at 7:37am

Hi,

thanx for your answer, the constaints are defined for each column. How can i get the currently selected Constaint of the item, the user is editing?

kind regards
Markus



Posted By: sserge
Date Posted: 24 April 2006 at 7:51am
Just iterate constraints for an appropriate column, which index is an item index. See below:


For Each c In wndReportControl.Columns(Item.Index).EditOptions.Constraints
    Debug.Print c.Caption
Next


--
WBR,
Serge



Posted By: cmaxmedia
Date Posted: 24 April 2006 at 8:28am

hi,
thank you for your reply, but your the returned array is empty so the debug.print will not be fired.

I fill the column constraints as follows:

        Set Column = Me.wndReportControl.Columns.Add(1, "Typ", 150, True)
        Column.EditOptions.AddComboButton
        Column.EditOptions.Constraints.Add "Phone", 1
        Column.EditOptions.Constraints.Add "Email", 2
        Column.EditOptions.Constraints.Add "Homepage", 3

I have tried the following code:
Private Sub ReportControl_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)

For Each c In wndReportControl.Columns(Item.Index).EditOptions.Constraints
    Debug.Print c.Caption  '<= there's no debugger output
Next

End Sub

i am working with Codejock XTreme Suite Pro ActiveX V9.81
thank you for your support
Kind regards
Markus



Posted By: cmaxmedia
Date Posted: 25 April 2006 at 3:53am

oh sorry, i have currently checked, that this is the wrong forum for activex com  .

i'd be very pleased, if you can send me a code sample

kind regards
Markus



Posted By: sserge
Date Posted: 25 April 2006 at 2:13pm
in your sample code, it fires ValueChanged if you change any item, but you should iterate constraints for your "Typ" column item. So far, it should be working if you change it in a following way:

Set Column = Me.wndReportControl.Columns.Add(1, "Typ", 150, True)
Column.EditOptions.Constraints.Add "Phone", 1
Column.EditOptions.Constraints.Add "Email", 2
Column.EditOptions.Constraints.Add "Homepage", 3

Column.EditOptions.AddComboButton



Private Sub ReportControl_ValueChanged(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem)
 If Item.Index = 1 Then
  For Each c In wndReportControl.Columns(Item.Index).EditOptions.Constraints
      Debug.Print c.Caption
  Next
 End If

End Sub



My previous piece of code works fine if you insert it into standard ReportSample, _ValueChanged handler.

If it still doesn't work for you, try attaching your sample and I'll check it up.

--
WBR,
Serge


Posted By: cmaxmedia
Date Posted: 27 April 2006 at 2:57am

Hi, It works!!

i am working with adodb.7 recordsets to fill the user data into the report as follows:



Set Record = .Records.Add
Set Item = Record.AddItem("")
            
Set Item = Record.AddItem(CStr(MyRS("strCommunicationType")))
Item.Caption = CStr(MyRS("strCommunicationType"))

Set Item = Record.AddItem(MyRS("strValue"))
Item.Caption = MyRS("strValue")

Set Item = Record.AddItem("")
Item.Caption = NZ("")

Set Item = Record.AddItem(MyRS("ysnMain"))
Item.HasCheckbox = True
Item.Checked = MyRS("ysnMain")

Record.AddItem ""
Record.PreviewText = MyRS("ID")
Record.Tag = MyRS("ID")

take a look at the code line 3 and 4. now i am using the cstr() vb-command AND => it works

Thank you for your support.
markus




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