KnowledgeBase for Data Dynamics Reports

Print Search Rate
    
   07-12-2007, 3:14 AM
HOWTO: Create an interactive check box
Attachment: InteractiveCheckBox.zip
DD Reports supports limited number of interactive actions (sorting, jump to report, jump to bookmark, jump to URL, visibility toggling etc.), but you can emulate your own interactive elements using report parameters, custom code and "jump to report" action of the TexBox. An example on how to create selectable checkboxes is attached (you may need to check data source settings for this example to work).

Here is a brief explanation of how this example was created:

Note: we will assume that the report is called InteractiveCheckbox.rdlx and TextBox that will serve as the checkbox name is TextBox1 (and it's in the Table1)


1) Create new hidden string report parameter named RowsChecked and set it's default value to "a"  (it will store our check boxes states)
2) Add custom code that will evaluate parameter value:

function SetState(RowList as string, RowNum as integer, RowCount as integer) as string
    ' checks if the parameter is too short to hold states of all the check boxes and extends parameter if needed
    if RowList="a"
        RowList = RowList.PadRight(RowCount,"a")
    end if

    ' changes char state based on selected check box current state   
    if (RowList.Chars(RowNum) = "a")
        RowList = RowList.Remove(RowNum,1).Insert(RowNum, "b")
    elseif (RowList.Chars(RowNum) = "b")
        RowList = RowList.Remove(RowNum,1).Insert(RowNum, "a")
    end if
            return RowList
end function

function StateCheck(RowList as string, RowNum as integer) as boolean
    ' checks current checkbox state
    if RowList="a"
        return false
    elseif RowList.Chars(RowNum - 1)="a"
        return false
    else
        return true
    end if
   
end function


3) Set TextBox1 action to "jump to report", in the Navigation smart panel select InteractiveCheckBox.rdlx, set parameter name to RowsChecked and parameter value to
=Code.SetState(Parameters!RowsChecked.Value, RowNumber("Table1") -1 , CountRows("DataSet1"))
(this will toggle the state of the check box)

4) Now set background image source of the TextBox1 to Database and background image value to
=IconSet("Symbols2", Code.StateCheck(Parameters!RowsChecked.Value, RowNumber("Table1")), false, true, false, false)
(for more information on IconSet please refer to the "Icon Set" topic of the documentation)

GrapeCity » Knowledge Base » KnowledgeBase f... » HOWTO: Create an interactive check box
Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.