Replace SQL for Clarion VIEW field

There was a discussion recently on comp.lang.clarion about how to fetch data from a table that isn't in the dictionary into a browse view.  Oleg Fomin made a suggestion that is brilliant and uses a feature in the Clarion VIEW engine that I had NO idea about!

What you can do, is replace the entire SQL that is used in the SELECT statement for any given column.  You can find this in the Clarion help under "SQL Drivers | Runtime SQL properties for Views"  

Lets say that you have a browse view that looks something like this:

 

BRW1::View:Browse VIEW(CalendarEvents)
  PROJECT(CALEVE:Completed)
  PROJECT(CALEVE:AllDay)
  PROJECT(CALEVE:StartDate)
  PROJECT(CALEVE:StartTime)
  PROJECT(CALEVE:Subject)
  PROJECT(CALEVE:StartDateTime)
  PROJECT(CALEVE:TypeID)
END

This is from a view based on Noyantis + CodeJock calendar.  With a little bit of code you can change for example the subject works:

CalendarEvents {PROP:Alias} = 'CALEVE'
BRW1::View:Browse {'CALEVE:Subject',PROP:NAME} = |
'SELECT Subject FROM dbo.SomeTable ST WHERE ST.TypeID = CALEVE.TypeID'


At runtime, this would then use this SQL code to fill the CALEVE:Subject field in the Clarion VIEW and thus in the browse or report or process or whatever else you might use a Clarion VIEW for.  

Note that if you have the Icetips Utilities, you can use a template to set the PROP:Alias for all procedures using the PREFIX of the files.  Check out the "Icetips Utilities: Alias Files" template.  It is a global template only and will add the code to alias the files to most procedures.  

Enjoy!

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk