DATAFILE= In OpenInsight
Published 19 AUG 2011 at 06:39:00PM by Sprezz
One of the nice features that AREV has that is missing from OpenInsight is the ability to change the datafile of a databound window on the fly by adding the modifier DATAFILE=NewDataFileName onto the sentence being used to launch the window. This was frequently used when multiple files shared the exact same structure - for example a "current" file and the associated archive files.
As we've mentioned we're working on a large AREV→OI conversion and we really missed this facility so in true Sprezz style we decided that we'd better implement it.
This proved to be easier than even we had anticipated due to the similarity between OI Window Common and AREV Window Common. The workaround we implemented is only good for windows which only update one file, though it wouldn't take much to make it suitable for multi-file windows. The following code shows how to implement it in a create event although of course if you have a promoted event framework you might choose to do it there.
winId = @Window $Insert OIWin_Comm_Init $Insert OIWin_Equates
create: changeRequired = index( param1, "DATAFILE=", 1 ) if changeRequired then newFile = param1[ changeRequired + 9, @Fm][1, " "] JoinMap@><1,JMAP_TABLENAME$> = newFile end return