This is my string: Transporter Doc. No & Date : 17392 & 22/10/2018
I have separated this string using split string like as TransporterDocNoDate.Split("&".ToCharArray)(1)
but in case date[ & 22/10/2018] missing, my workflow getting failed. how could handled this.
Buddy may i know what value you want here buddy @smita.mobifly
from this in_text = "Transporter Doc. No & Date : 17392 & 22/10/2018"
Fine if you are trying to get the date next to & symbol
then use this buddy out_date = Split(in_text,"&")(1).ToString.Trim
this would fetch you the value of “22/10/2018”
And is there is no value next & or even there is no & you can handle it with a try catch block buddy
put the above two assign activities in try block and mention a log message activity in catch with a message like “there is no & and no more string next to &”
This implies that when there is value, you will get from try block with the date value or if not the workflow will go to catch block as it catches the exception and wont stop the workflows execution, thus showing log message like you dont have any & or value next to &…
Simple buddy
Kindly try this and let know buddy @smita.mobifly
Cheers
Fine
That sounds clear,
so
to get the Transporter Doc. No:
like this buddy in_text = "Transporter Doc. No & Date : 17392 & 22/10/2018"
Fine if you are trying to get the date next to & symbol
then use this buddy out_TransporterDocno = Split(Split(in_text,":")(1).ToString.Trim," ")(0).ToString.Trim
Modified @smita.mobifly
then for date
like this buddy out_date = Split(in_text,"&")(1).ToString.Trim
if there is date value you will get the date or
if you have place this in Try Block of Try Catch activity and if there is no value for data, then you can handle in catch with an assign activity like this
out_Date = “Null” (null as a string)
or
out_Date = String.Empty
Cheers buddy @smita.mobifly
Kindly try this and let know buddy
aah then fine i thought you are passing directly as insert statement with the value…if you are passing from a excel you can replace the value with for each row loop and a if condtion like
String.IsNullOrEmpty(row(“columnname”))
Then
row(“columnname”) = “Null”
But any how this will add as string only buddy… @smita.mobifly
I think nothing will work perfectly buddy, for more info look at this, even i verified