Hi,
I am reading data from the queue, but I want to check if its null or not and then assign it.
I can use and If statement with a condition like this:
in_TransactionItem.SpecificContent.Any(Function(x) x.Key = “WorkflowInstanceID” AndAlso x.Value IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(x.Value.ToString))
But I want to write it in a single assign, without using IF,
How can I do that?
Thanks
vrdabberu
(Varunraj Dabberu)
June 1, 2024, 1:54am
2
Hi @chauhan.rachita30
Try the below syntax:
workflowInstanceID = If(in_TransactionItem.SpecificContent.Any(Function(x) x.Key = "WorkflowInstanceID" AndAlso x.Value IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(x.Value.ToString)),in_TransactionItem.SpecificContent("WorkflowInstanceID").ToString, Nothing)
Regards
1 Like
Anil_G
(Anil Gorthi)
June 1, 2024, 4:53am
3
@chauhan.rachita30
Please try this
workflowInstanceID = If(in_TransactionItem.SpecificContent.Any(Function(x) x.Key = "WorkflowInstanceID" AndAlso x.Value IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(x.Value.ToString)), in_TransactionItem.SpecificContent("WorkflowInstanceID").ToString,Nothing)
Cheers
1 Like
lrtetala
(Lakshman Reddy)
June 1, 2024, 5:55am
4
Hi @chauhan.rachita30
Try this
If(in_TransactionItem.SpecificContent.ContainsKey("WorkflowInstanceID") AndAlso in_TransactionItem.SpecificContent("WorkflowInstanceID") IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(in_TransactionItem.SpecificContent("WorkflowInstanceID").ToString), in_TransactionItem.SpecificContent("WorkflowInstanceID").ToString, String.Empty)
Regards,
1 Like
system
(system)
Closed
June 4, 2024, 5:55am
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.