Forum Discussion
Setting data fields is unique
- Anonymous2 years ago
Hi,
As seen in the documentation (i didn't read it all), I don't know if it exists a normal way to say "don't accept this field if it has already been added".
You can probably find a way to "hard-code" this but I don't think it's a good idea.
However, you can manage the Data Roles in the capabilities.json file to ensure the data you drag into your fields respect the data type (related to Power BI Data Types)
Capabilities and properties of Power BI visuals - Power BI | Microsoft Learn
Also, you can watch the others custom visual codes to get an idea about how you can manage your data roles:
By the way, I think the best way to develop your custom visual is not to make sure that the users won't be able to drag 2 or more times the same data, but to be sure that your data roles are well defined to prevent misunderstanding and avoid this case when the same data is dragged too much times
Have good day
lbendlin , Sorry for pinning you on this news, but can you tell me if there is a way for each data field to only be dragged and dropped into 1 visualizations field?