Hi all
I have a doubt about how to set up an MP on a spectrum analyzer client via script.
I see a question here in the dojo that helps me a lot to understand how to customize the MP.
But my question is about, how I can set this MP on the client (cube or Low-Code App) via script?
The method SetMeasurementPoints seems to receive an entire list of MPs, but it now gives the possibility to set one of them, and if I miss passing another MP in the list, it will delete the already existing in the spectrum analyzer.
Edit to explain better my idea:
At the moment in the MP i setup only the input port, and via script I want to "tick" the MP on the client that could be the Cube or Low Code App. (Below an image to explain better)
So my point is to "active" one of this MP via script, is something possible?
Hi Marco,
As far as I know, this is not possible via the API.
In DataMiner Cube a workaround is possible by making these configurations:
- In the spectrum element, enable "visualize measurement points" from the "measurement points" tab in the ribbon
- In the "Card" tab of the user settings, select "Open spectrum Analyzer" as "Default opening behavior for cards showing measurement points"
That way, you will get a list of measurement points in the surveyor:
Opening one of these measurement points will open up your spectrum element with the measurement point already selected:
These measurement point cards can also be included in workspaces for easier opening together with other cards.
As far as I know, there is no similar method to do this in low-code apps.
Hi Marco,
this may depend on how your script is treating the existing MP’s. To handle this correctly, you need to first read the existing MP’s, add or edit the ones you want to change and then send a message back that includes the existing + new MP’s. That way existing services should not be deleted. Next to the question you linked, please also take a look at https://community.dataminer.services/question/preselecting-measurement-points-script/. I’ve posted a code snippet there that encapsulates the messages in a class and might be easier to use.
Hi Marco,
Thanks for adding extra information in the question. This sure helps to better understand your question.
As far as I gather, you want clients to automatically have a certain measurement point selected when they open a spectrum display.
Which measurement points are checked in the measurement point list as displayed on a spectrum card in Cube is a user-specific setting that applies to the sessions of that user only. If one user selects MP1 this MP1 will re-open when opening a new card, while a second user might have MP2 configured.
I'm afraid that there is no API to updated these presets/settings for all users in one go, or for active sessions.
Saving/updating this "measurement cycle" in a shared preset might be an option, but one will have to manually load those presets from Cube, which doesn't really sound as what you want.
If it can be of any help: Cube does allow for a measpt input argument which will select the specified measurement point.
Hi Wouter
I’ll keep in mind the measpt input argument, maybe can help in my project
Hi Marco,
You are correct: the SetMeasurementPoints method does expect definitions for ALL of the measurement points at once and will consider previously existing measurement points that do not appear in the new data as deleted.
There is currently no method to add or update a single measurement point.
Best approach here would be to call GetMeasurementPoints first and then extend/update the data returned from there. This updated data can then be sent back through SetMeasurementPoints. This will make sure that previously existing measurement points keep their configuration.
As far as I remember, the "object" type output of GetMeasurementPoints can be cast to object[] where each entry in there can be cast to string[], which is the same format as what SetMeasurementPoints expects as input.
Hi
Yes my approach at the least is the same you suggest, so retrieve all the MPs, search the one I need and change it, then upload the entire array of MPs as I received, but in case I would also give the possibility to the user to enable one specific MP on Cube/Visio or LCA? this is possible via script?
Unless I’m missing something, where the automation script is being launched from (Visio/LCA/directly from automation/scheduled/…) doesn’t really matter here?
From the automation script you should be able to fetch all measurement points / make updates and re-apply the updated set
Hi Wouter
You are right, from where the script are launched is not the point, but if there is the possibility to “set active” one MP, anyway I update my question to explain better my case
Hi Michiel
I already tried with the MP as service, but never got the point you suggest, it could help for sure, anyway I tried to create and delete vai script few MPs, but when the script end the execution, all the services created for each MP are gone. so if some else using one of that service, and the script start, that service will be deleted.
I’m thinking to use the MPs to have access to different input ports, and try to create preset via scripts to set the propertys.