Forum Discussion
Object level security - Paginated Report (missing column)
Hi Abhinav,
thanks for the code, this could be very helpful workaround and I'll try it. My only concern is that Roles and OLS in PowerBI Dataset could be changed, so tomorrow some other field could be secured for some Role and I have no way of identifying it dynamically in the paginated report and prevent future crashes, unless I call this function for basically any field I am using in the report. That is why I was hoping that I can handle error on the DAX side somehow when fetching measure that for some users will not even exist.
I’ll for sure try this approach end let you know if I had any issues.
Thanks!
Petra
Sure Petra!
And you may not bother about any perf impacts as I have widely tested this on missing fields with almost all having to use the code check. This worked even when the datset result goes missing altogether with no columns returned.
Thanks!
- PetrarteP5 years agoFrequent Visitor
Hi Abhinav,
I am strugling with the code and need help. Field for which I added expresion "=code.GetValue(Fields!Val_Opening_Balance_Amt.Value)" is rendering to "#error" even for me in Report Builder. Maybe it is because I am putting decimal type field and it is formatted in the matrix as number and not the string. Also I need to Return Nothing and not " ". Can you help to adjust the code? Thank you!
- AbhiSSRS5 years agoSolution Sage
Hi Petra! Please pass only the field as the argument is field type
ByVal dataElement as Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field
so the code call has to be : =code.GetValue(Fields!Val_Opening_Balance_Amt). This works
- PetrarteP5 years agoFrequent Visitor
Hi Abhinav,
thanks for the info and all the help, now report is working for me as I am in the Role without OLS restrictions but users under different roles are getting same error:
Could not connect to the data source.
"There was an error communicating with Analysis Services. Please verify that the data source is available and your credentials are correct. Query (14, 84) The value for 'Val Stock Net Movement Amt' cannot be determined. Either the column doesn't exist, or there is no current row for this column.".From the error I see that probably it fails on the PowerBI Dataset as I am querieng it with DAX in Paginated Report. That is why I think I need to do something on the DAX code itself to catch an error. I am greatfull for you answers as this code will be usefull in other scenarios.Petra