Adaptive TryParse

i don’t understand why the adaptive ToString is picked up, while the adaptive TryParse isn’t.

similar question for records:

tryparse.vl (35.8 KB)

Took me also a while, but the main input of TryParse is called “String” :/
Once you name yours “String” as well it works.

2 Likes

arghhhhh and thanks!

@sebl a question : you are creating your own TryParse function to see if your record is well instancied ?

in VL.XmlModule, i’m working with e.g. XPathGetValue which internally uses GetValue, which uses a TryParse. So, if one provides an adaptive TryParse Implementation for some Datatype (Which is a Spread in my case), one could use the existing XPath nodes.

thank you @sebl, i have a side question do you know if there is any ressource to check if a data or a spread is valid ( empty not empty ) ? blocking my patches regulary on this subject

you can check with IsAssigned against Null and for collections check for Count > 0 to see if they are empty.

Two cents: there’s an Any node which returns true if a collection has any slice :

Could make patches more readable than Count, > :)

2 Likes

I’m not sure, but I think you have to cache it as other linq methods…

@sebl @antokhio @sebescudie ok i will try that one, as actually if the data is not in my saves it crashes the app on start, because of imgui.
I will try the different approaches and come back to you ! thank you !