I have a reporting-tool that has a jobconfiguration (json) as an Asset.
It also has a test-jobconfiguration (json) as an Asset.
The reason for this is that it runs monthly using the ordinary configuration, but it is possible to fill in a test-configuration and run it manually if I want to tune how report is compiled, a new report should created etc etc.
Since it is not possible as far as I know to set an Asset to empty/nothing/null we have to fill the test-configuration with something and check in the code if it is set or not.
My workaround is to see if the configuration is a certain length.
Is there a way to set an Asset as empty/nothing/null? If not what is the reasoning behind this?
A simple checkbox when creating the Asset would be nice, like:
“Allow Empty Values ” or something like it.
setting a value to Null would result also to check like isNothing(AssetValue) or else
Not checking the value would result to a Null Exception.
So close to your mentioned workaround:
setting asset datatype to Text and the value to “” (empty string) let create the asset
Afterwards it cann be checked by String.IsNullOrEmpty(AssetValueVar)
As mentioned it is close/a variation to the above mentioned workaround
About:
feel free to place the suggestion alonf with some elaborations on motivation, relevant use cases at the Feedback - UiPath Community Forum feedback category
As per my knowledge…
Currently, in UiPath, it’s not possible to set an Asset to be empty or null directly. Assets in Orchestrator always require some value, and the platform doesn’t support explicitly storing a null or empty state for an Asset.
Setting a String Asset to “” does not set it to an empty string, it sets it to a string containing “” i:e “”“”. Therefor it can’t be checked with IsNullOrEmpty.
It is a bit confusing that sometimes you SHOULD put “” around your string and and in other places you should not.
Assigning a value to a variable, you should use “value”.I know since otherwise there is no way for Studio to know if it is a value or a variable.
But when assigning a value to an Asset you should not put “value” because then it will contain “"value"”.
Property fields aside, and simplifying, something in quotes is always a string literal, and things without quotes are variable references.
Studio uses standard expression compilations for VB.Net and C# (depending on which language you’re using). If you find the syntax of string literals vs variable references confusing, I’d highly recommend a basic C# course, focusing on variables.
Caveat:
There is an edge case mentioned earlier (property fields) - these were rare in the past, but if you’re unsure if it’s a property field or an argument field, see if there’s an “Open in Advanced Editor” option for it. I know I have been caught offguard with some activities related to assets like that.
For example:
If you notice the hint texts difference, and the {} on the second screen capture, that’s because by default Asset activities expect you to choose an asset from the list (and it will be treated as a literal value, so no quotes). The catch here is if you put here myVar it will be treated literally.
But if you click on the + and use a variable or advanced editor, it will switch to an expression field (indicated by the {}). So no if you put here myVar it will use the value referenced by that variable, because it will evaluate the expression.
Same with the Orchestrator folder path - right now it’s looking for a literal value (no {} - property field) but can be flipped to the expression argument field.
If it’s still confusing, it could be a separate topic, to not derail too much here.
@teodora.baciu - this is a good example to your inquiry in the other topic on the developer user experience, and what can cause confusion due to activities being “overloaded” on what they can do.