Author Topic: Report View Recordset Column Names as Report Header  (Read 212 times)

stanl

  • Pundit
  • *****
  • Posts: 997
Report View Recordset Column Names as Report Header
« on: January 26, 2020, 05:55:48 am »
I'm sure this is doable, but I am just getting into ReportView in WB.  I changed an Itemlist for a simple (no callback) dialog to Reportview. Simple ADO query => Getrows() creates the array and I want the first row to be a header and non-selectable. How do I have it display recordset column names instead of the first row of data?


[EDIT]:  ArrayInsert looks promising. Maybe I can answer my own question.


[EDIT 2]: My RFM for the day
Code: Winbatch

arrData = oRS.GetRows()
row = 0
rowflag = 1
ArrayInsert( arrData, row, rowflag, "" )
fcount=oRS.Fields.Count
flds=""
For i=0 To fcount-1
   flds=flds:oRS.Fields(i).Name:","
Next
flds=StrSub(flds,1,strlen(flds)-1)
arrB = Arrayize( flds, ',' )
For element = 0 To ArrInfo( arrB, 1 )-1
    arrData[row,element] = arrB[element]
Next
 

JTaylor

  • Pundit
  • *****
  • Posts: 1080
    • Data & Stuff Inc.
Re: Report View Recordset Column Names as Report Header
« Reply #1 on: January 26, 2020, 05:05:24 pm »
Did you solve your problem?   Sorry if I am being dense.

Jim

stanl

  • Pundit
  • *****
  • Posts: 997
Re: Report View Recordset Column Names as Report Header
« Reply #2 on: January 27, 2020, 02:47:31 am »
Took about 1/2 hour - my RFM moment ::)

JTaylor

  • Pundit
  • *****
  • Posts: 1080
    • Data & Stuff Inc.
Re: Report View Recordset Column Names as Report Header
« Reply #3 on: January 27, 2020, 06:22:36 am »
Okay.  Thought so but wanted to make sure.

Jim

stanl

  • Pundit
  • *****
  • Posts: 997
Re: Report View Recordset Column Names as Report Header
« Reply #4 on: January 28, 2020, 04:57:02 pm »
One more question though. Is there a way to make a reportview (no callback involved) select the first array element in the list - much like the pre-selected item you can set in the dropdown control?

JTaylor

  • Pundit
  • *****
  • Posts: 1080
    • Data & Stuff Inc.
Re: Report View Recordset Column Names as Report Header
« Reply #5 on: January 28, 2020, 05:56:04 pm »
Hmmmmmm...Don't think I have ever done anything with a reportview outside a Callback.  I gather setting focus on the control doesn't do it?   Not sure if it defaults to a specific selection on population or not.  SendKeyTo is the only think I can think of at the moment but not sure that is a good solution.

Hopefully someone else will have an answer.

Jim

td

  • Tech Support
  • *****
  • Posts: 3210
    • WinBatch
Re: Report View Recordset Column Names as Report Header
« Reply #6 on: January 29, 2020, 07:18:02 am »
You can use the Control Manager list view function cSetLVItem to set the selected item.  However, a dialog callback using (DialogControlSet with @dcSelect) is a simpler approach.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

  • Pundit
  • *****
  • Posts: 997
Re: Report View Recordset Column Names as Report Header
« Reply #7 on: January 30, 2020, 03:03:35 am »
I guess I will need help with 4th parameter. Nothing I have tried selects the first row. Basically I'm using reportview as a lookup, single select where each column value becomes a variable for SQL statements and eventual Excel template creation.


Code: Winbatch

#DefineFunction MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,rsvd)
   Switch MyDialog_Message                                    
      Case @deInit                                            
         DialogControlSet( MyDialog_Handle, "ReportView_1",@dcSelect,1) ;thought 1 would select 1rst row
         break
    endswitch
    return @retDefault
#EndFunction
 

JTaylor

  • Pundit
  • *****
  • Posts: 1080
    • Data & Stuff Inc.
Re: Report View Recordset Column Names as Report Header
« Reply #8 on: January 30, 2020, 04:39:24 am »
Sorry.  You said you didn't want to use a callback so didn't offer this suggestion...

The fourth parameter needs to be the value of the 1st column that you want selected.   So, if the 1st column of the first row is "Bugs", that is what you would use.

Jim

stanl

  • Pundit
  • *****
  • Posts: 997
Re: Report View Recordset Column Names as Report Header
« Reply #9 on: January 30, 2020, 05:56:50 pm »
I didn't want to, but I didn't want to didn't want to go the control manager route either :-\ Thanks.

JTaylor

  • Pundit
  • *****
  • Posts: 1080
    • Data & Stuff Inc.
Re: Report View Recordset Column Names as Report Header
« Reply #10 on: January 30, 2020, 08:18:34 pm »
I understand.  Any time...

Jim