Hi Everyone,
I’ve got a ti that updates a dimension with sql table as data source. So I got a parameter used to filter the dimension name in sql. If user has a typo in parameter (that means spelling doesn’t match the one in sql), then I wanna generate an error in the log & quit the ti because sql query wouldn't return any row/data. Is there a way to do this in Prolog?
error check on sql data source in prolog
- qml
- MVP
- Posts: 1098
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: error check on sql data source in prolog
Not in a single-TI solution. This is because Prolog is executed before the data source is accessed, so you have no knowledge of what the data source will have returned.elee123 wrote:Hi Everyone,
I’ve got a ti that updates a dimension with sql table as data source. So I got a parameter used to filter the dimension name in sql. If user has a typo in parameter (that means spelling doesn’t match the one in sql), then I wanna generate an error in the log & quit the ti because sql query wouldn't return any row/data. Is there a way to do this in Prolog?
Having said that, you can achieve that with a little bit of creativity, so not sure why you want to limit your options to Prolog code only. Why not e.g. have a counter incremented on the Data tab. Then in Epilog you can check if the counter has been incremented and if not (meaning that the data source was empty, so presumably the parameter incorrect), raise an error then.
Another approach would be to have a subprocess executed from the Prolog whose only purpose would be to run a separate query and reurn the status of the parameter. That way you'd run two queries - one to validate the parameter and one to get the data when the validating query is successful.
Kamil Arendt
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: error check on sql data source in prolog
Or run a distinct query into SQL first to create a dimension in TM1 that will form a picklist where the user is validated on their selection of parameter before it ever goes out to the process.
Declan Rodger