CrossTab, How to get text into TagStr of a cell's memo?

hsmhsm
edited November 2012 in FastReport 4.0
I have a cross tab that displays a StudentName in the first column, SubjectCode in the first row and the Grade for each student / subject in the cells.
The dataset also holds the StudentID (string) but this is not displayed.

I want to use the OnClickObject event of the report so that if a cell in the crosstab is clicked I can obtain The StudentID and SubjectCode. Then I intend to run some other sql and display some other data to do with that StudentID and SubjectCode.

Using VarToStr(ColumnValues[0]) in the OnPrintCell event I can get the subject code for the cell and put it into the TagStr of the cell's memo so that I can parse it out later but I can't see how to get the correct StudentID in there as well.

ie this does not work, I get the last StudentID not the current one.
memo.tagstr :=memo.tagstr + ' ID:' + <frxDsGradeData."ID"> + ' SubjectCode:' + VarToStr(ColumnValues[0])

I think it might be possible to do it by putting the StudentID into the tagstr of the relevant memo in Row0OnBeforePrint event and then copy it from there to the cell's TagStr in the OnPrintCell event but I have no idea of the syntax to do either of these.

Am I on the right track or is there an better way?

Can anyone help with the correct syntax to get the two bits of data that I require inside the cell's tagstr?
Howard

Comments

  • gpigpi
    edited 8:48AM
    wrote:
    I think it might be possible to do it by putting the StudentID into the tagstr of the relevant memo in Row0OnBeforePrint event and then copy it from there to the cell's TagStr in the OnPrintCell event but I have no idea of the syntax to do either of these.
    Try to use StudentName + StudentID in RowHeader and hide StudentID when RowHeader printed
  • hsmhsm
    edited 8:48AM
    gpi wrote: »
    gpi wrote: »
    I think it might be possible to do it by putting the StudentID into the tagstr of the relevant memo in Row0OnBeforePrint event and then copy it from there to the cell's TagStr in the OnPrintCell event but I have no idea of the syntax to do either of these.
    Try to use StudentName + StudentID in RowHeader and hide StudentID when RowHeader printed

    Thanks gpi.
    I went to bed last night thinking about this problem and woke up this morning with exactly the same idea!
    Glad to have it confirmed by somebody whose opinions I respect.
    Howard

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.