Skip to main content
5-Regular Member
September 11, 2017
Solved

How to create a else statement if Key Does not exist

  • September 11, 2017
  • 2 replies
  • 3393 views

Hello,

I created a service that uses GetDataTableEntryByKey to search an infotable, and then depending on another field definition it would create a result true or false. However if the key doesn't exist yet it creates an error saying Key Does Not Exist. What ELSE statement would I use so if the Key is not yet created it would populate a false result? Because if it doesn't exist I want it to be result = false.

Does anybody know the right approach for this?

Best answer by mpartridge

I was able to get it to work after changing it from GetDataTableEntryByKey to FindDataTableEntries. Below is the script that I used to get it to work, using the GetDataTableEntryByKey service did not allow the typeof command to work, but it did with FindDataTableEntries.

2 replies

1-Visitor
September 11, 2017

check your variable infotable if equals to null before accessing the property checked_Out

mpartridge5-Regular MemberAuthorAnswer
5-Regular Member
September 11, 2017

I was able to get it to work after changing it from GetDataTableEntryByKey to FindDataTableEntries. Below is the script that I used to get it to work, using the GetDataTableEntryByKey service did not allow the typeof command to work, but it did with FindDataTableEntries.