Page 1 of 1

Check if repo item does not exist then do work

Posted: Mon Dec 07, 2015 4:42 pm
by tronicza
Hi all,

I have a situation where I added an object(objectA) to my repo, it is text which sometimes exists inside a table(datagrid). When the text is not there, i want to insert it, otherwise move on.

I have written the following if statement:
if(!repo.App.Form.objectA.Exsists())
{
//do work to insert
}

When the text is in the table, my solution works and the code '//do work to insert' is skipped as expected.
However, when the text is not in the table, my solution gets stuck at this point and just hangs.

The same problem occurs when i use .Visible

Any ideas?
Thanks in Advance!!

Re: Check if repo item does not exist then do work

Posted: Wed Dec 09, 2015 9:01 am
by odklizec
Hi,

I think the problem you are experiencing is not that your code hangs. I think it rather waits too long? Please examine the 'Effective Timeout' value of given repo element. The solution of your problem could be setting shorter Exists timeout, like this...

Code: Select all

if(!repo.App.Form.objectA.Exists(5000)) //Exists method stops searching the element after 5 secs