As I reflected back on what I learned from selecting the correct #askMode, I wondered myself.
It seemed over-complexifying to add the mode + values on one line, and then parsing them with #modeFromValue and #askModeMathFormat and #askValuesReadFormat. I have seen DMM that do not offer commands to retrieve "mode" and then you are stuck using it, but my LCR meter does provide "mode" as a command.
So at the beginning there this was the result:
; ----- Read measurement ------
#askValues FUNC?;FETCH:MAIN?
#askValuesReadFormat xff
#askModeMathFormat getElement(value,0,"[- ]")+" "+getElement(value,1,"[- ]")
#modeFromValue getElement(value,0,"[- ]")+" "+getElement(value,1,"[- ]")
; ----- Read mode -----
#askMode FUNC?;FETCH:MAIN
But I simplified it dramatically to this:
#scpiCmd ASKMAIN? FUNC?
:readmath: replace(value,"-"," ")
; ----- Read measurement ------
#askValues FETCH:MAIN?
; ----- Read mode -----
#askMode ASKMAIN?
No more #modeFromValue, #askModeMathFormat and #askValuesReadFormat and ultimately faster since the meter only sends the "values" during #askValues.
I never understood from the documentation that #askMode needs a <space>-separated list of modes and that #askValues needs a comma-separated list of values, but now I do.
Just wanted to share this insight with you all.
PS.
Is there a way to avoid the ASKMAIN? so that the string replace that is needed is on the same line a #askMode ?