Execption In Initialization state

Hi ,

I am downloading an excel report and filtering the conditions using linq in Initialization State.When there are no data rows present , it should not proceed to Get Transaction item and should throw exception message “No Data rows present”. In Catch Block where shall I add the exception so that it should not proceed to Get Transaction item if there are no data rows present in file

@marina.dutta,

Just add one transition from init state to end state with condition

Yourdatatable.RowCount = 0

Thanks,
Ashok :slightly_smiling_face:

@ashokkarale

Do I need to add here

There one more will be there and modify your conditions
For get transition data you can add exception nothing and your Dt.row’s count <>0 and for this new state you can add your Dt.row count =0
Like this you can add
Or if u do not want to add state
Declare condition in ending step where you will check count and based on that you can add throw
But for this u need to have proper variables declare in a flow where they will have access in this states

@jast1631

Do you have workflow example. If possible

Share your project here with the exact condition you want
Will check into that

@marina.dutta,

This way use this expression in Transition Condition.

dt_TransactionData Is Nothing OrElse dt_TransactionData.RowCount = 0

No Transaction Data

Thanks,
Ashok :slight_smile:

@marina.dutta

Instead of adding one more transition.when there is no row in datatable …I believe you are using a condition in get transaction data to send each row…when there is no row present just assign nothing to transaction item and by default ref will move to end process even if it goes to get transaction data as the process needs to end if there is no data in transaction item as per ref

Cheers

@Anil_G

Actually before Get Transaction Data, In Initialize All Applications, the bot downloads file and then puts some conditions to filter in that file and copies to another sheet called filtered sheet. The Get Transition reads the filtered sheet. If no data rows are found , it should end . But in my case , it goes to Get Transition and does not find the filtered sheet because there was no data rows found in downloaded filtered data table and hence throwing the error.

If there is no filtered conditions, I want the bot should throw exception in initilization all application state after downloading the excel and putting the filter (if no data rows are present)and end process instead of going to Get Transition State

@Anil_G @ashokkarale

I have put a condition if filtered data table count>0 the proceed with remaining task else throw system exception and then it goes to end process instead of get transaction. This approach is working ,once the bot throws sytem exception in initialization, it ends process.

Let me know if this approach is correct.

@marina.dutta,

If it’s working then it’s fine I think. Just document it clearly with all the minor details in annotation. As this is something very customized changes you are doing to REFramework it will be hard to understand to other developer or ourself also after long time that why did I code like this :smiley:

Cheers!

2 Likes

@marina.dutta

As long as it is working it should be fine

but to make it easy for other developers too it is better to make it standard

cheers

@Anil_G

Yes you are correct. But in my case it is failing in Initialization application itself is there is no data in excel file after filter data table. In Get Transaction it should read the filtered data but since before that itself In iNitialize file there are no data rows , The Get Transaction is unable to read Input sheet

@marina.dutta

Then better explicitly call it out so that it is easier to understand what is being done

cheers

@Anil_G

ok . Explicitly to call out what should be the approach?

@marina.dutta

I see you are checking the count after a filter…better to use a filter datatble as most of it are straight forward only or separately filter it in assign and then use output to check…and add some annotations whereever possible

cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.