Assign a default value if variablle is empty or null in assign activity itself

I have seen some syntax like this

Var =ExtractedDataSet.Tables(0).Rows(0)(0).ToString ? "Unable to extract value"

somewhere to check the variable contains value then assign the value from that or otherwise just assign the default value right next to it , is there any thing like this actually or im dreaming

EDIT:- Just for those who are thinking to add if condition in the assign , no im not talking about that

@indiedev91

Var = If(Not String.IsNullOrEmpty(ExtractedDataSet.Tables(0).Rows(0)(0).ToString), ExtractedDataSet.Tables(0).Rows(0)(0).ToString, "Unable to extract value")

Hi @indiedev91

Var = If(String.IsNullOrEmpty(ExtractedDataSet.Tables(0).Rows(0)(0).ToString()), "Unable to extract value", ExtractedDataSet.Tables(0).Rows(0)(0).ToString())

Hi @indiedev91

Use the below expression is Assign activity,

- Assign -> Var = If(Not(String.isNullOrEmpty(ExtractedDataSet.Tables(0).Rows(0)(0).ToString) AndAlso String.isNullOrWhiteSpace(ExtractedDataSet.Tables(0).Rows(0)(0).ToString)), ExtractedDataSet.Tables(0).Rows(0)(0).ToString, "Unable to extract value")
  • The expression retrieves the value from the first cell of the first row of the first table in ExtractedDataSet.
  • It checks if this value is neither null, empty, nor consists only of whitespace.
  • If the value is valid, it returns the value.
  • If the value is invalid (null, empty, or whitespace), it returns the string “Unable to extract value”.

Hope it helps!!

IF(isNothing(…) OrElse String.IsNullOrEmpty(…toString.Trim, "Default value, dtvar rows…)

Maybe better to invoke a variable in IT, when redundant parts are to avoid