Forum Discussion
Custom Search Visual
- 7 years ago
Hi,
Check the console and you will see that filterType is undefined.
It happens because constant FilterType.Tuple is unavailable -- it doesn't contain export declaration.
You need to use it like the following:
filterType: 6
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]
Hi,
Check the console and you will see that filterType is undefined.
It happens because constant FilterType.Tuple is unavailable -- it doesn't contain export declaration.
You need to use it like the following:
filterType: 6
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]
- jijods47 years agoFrequent Visitor
Hi ,
Thanks for the help. Let me know if there is any doc where I can find other values of the FilterTypes and their usage.
now the error has gone and it is working as I exepected.
and there was one more problem has occured. When I speified the column name one column has been miss spelled, so the entire filter has not happened. Is there any mechanism that if the column names or table names are miss spelled , an exception would thrown stating unknown column/table name found. or say if the value is not availble in the category no value exists. like so.
just asked out of curiosity.
otherwise if you could tell how to debug would be helpful. I have found this Link. But I don't know where to put the below code.
module powerbi.extensibility.visual { export function logExceptions(): MethodDecorator { return function (target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) : TypedPropertyDescriptor<any> { return { value: function () { try { return descriptor.value.apply(this, arguments); } catch (e) { console.error(e); throw e; } } } } } }Regards,
Jijo.
- v-evelk7 years agoMicrosoft Employee
Hi Jijo,
I am not sure that there is other information regarding using of filters, sorry.
I am also unsure regarding exception if column name in filtration is wrong, but try to wrap applyJsonFilter into try ... catch and throw an error in the catch block.
Regarding the code that you provided in the message, you can put this function-decorator at the same file as your visual class (outside of the class) and then don't forget to add this decorator to target method like below:
@logExceptions() public update(options: VisualUpdateOptions) {Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
[email protected]
- Anonymous6 years agoNot applicable
Hi evelk 🙂
I have a simomiller problem....
i cant apply the pbi js "setSlicerState()" function with the correct filter syntax.
when i run this on console i get :Uncaught SyntaxError: Unexpected token ':'
let filter: ITupleFilter = { $schema: "http://powerbi.com/product/schema#tuple", filterType: FilterType.Tuple, operator: "In", target: target, values: values }I was trying to constraact the filter this way:
slicerFilter = { $schema: "http://powerbi.com/product/schema#tuple", target: ITupleFilterTarget = [{table: "d1", column: "G1"},{table: "D1", column: "De"}], filterType: 6, operator: "In", values: [[{value: "adam"},{value: "josef"}]] };i later invoke it with the setslicerstate funcxtion:
... slicer.setSlicerState({ filters: [slicerFilter] }) ...but got a "filters property is invalid" error