ExampleDP_Arg1. is a single float value, not a dyn. Therefore you can not pass fVal as dyn_float but instead pass a single float value.
You can only pass a dyn_float when the DPE is also of this type.
So you would have to do it something like this
main()
{
dyn_string dpList = makeDynString("ExampleDP_Arg1.","ExampleDP_Arg2.");
dyn_string sVal;
dyn_float fVal;
Thanks! I was expecting the behaviour to be similar to dpGetDescription(), but I was wrong.
That's strange. Because the format is only defined once per DPE, regardless of it being a Dyn or not, I don't see why the dp argument needs to be a dyn. Feature request
Yes, I understand Martin. But notice that in the first example I gave, the first argument is indeed a string (name of DPE of type float = "ExampleDP_Arg1.") and it doesn't work. It needs a string which is the name of a DPE of type dyn_float.
The point is:
When you pass a dp-Name which addresses a DPE which is of a simple (non dyn) type, then you must also pass this simple (non dyn) type as second argument.
In your first example you pass "ExampleDP_Arg1." which is of type float but you did pass a dyn_float as 2nd argument, which is wrong.
So you always need to pass the 2nd argument which corresponds to the DPE datatype.
It looks to me like the second case is only for datapoints of dynamic datatypes, but not for a dynamic list of datapoints like in Nuno's first example.
What I think Nuno is trying to do in the example is a bit of a trick.
He has a bunch of datapoints that all have the same format and passes their values to the dpValToString() function in a dyn_float variable together with only the first datpoint name in dp,
expecting a dyn_string back with the float values converted to strings using the format of dp.
But the dpValToString function is quite strict here and apparently expects dp to be a dyn.. datapoint type if val is a dyn.. variable and throws the error that Nuno posted.
I find that legitimate because Nuno's "trick" above can backfire if someone does change the format of one of his datapoints,
therefore violating the assumption that he made.
So the clean way to get a dyn_string containing the properly formatted values of a list of simple (not dynamic) datapoints,
is to use the for constructor as in my previous reply.
But if for some good reason you insist on using the format of the first datapoint for all of your values, Nuno,
and accept the case where it could back fire on you or some innocent soul who might modify your software later,
you can also use my example but just change dpList to dpList[1] in the call to dpValToString().