WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: stanl on January 26, 2020, 05:55:48 AM

Title: Report View Recordset Column Names as Report Header
Post by: stanl 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) Select


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
Title: Re: Report View Recordset Column Names as Report Header
Post by: JTaylor on January 26, 2020, 05:05:24 PM
Did you solve your problem?   Sorry if I am being dense.

Jim
Title: Re: Report View Recordset Column Names as Report Header
Post by: stanl on January 27, 2020, 02:47:31 AM
Took about 1/2 hour - my RFM moment ::)
Title: Re: Report View Recordset Column Names as Report Header
Post by: JTaylor on January 27, 2020, 06:22:36 AM
Okay.  Thought so but wanted to make sure.

Jim
Title: Re: Report View Recordset Column Names as Report Header
Post by: stanl 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?
Title: Re: Report View Recordset Column Names as Report Header
Post by: JTaylor 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
Title: Re: Report View Recordset Column Names as Report Header
Post by: td 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.
Title: Re: Report View Recordset Column Names as Report Header
Post by: stanl 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) Select


#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
Title: Re: Report View Recordset Column Names as Report Header
Post by: JTaylor 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
Title: Re: Report View Recordset Column Names as Report Header
Post by: stanl 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.
Title: Re: Report View Recordset Column Names as Report Header
Post by: JTaylor on January 30, 2020, 08:18:34 PM
I understand.  Any time...

Jim