Ask Your Question
1

How can I check if a field exists in the Jython Evaluator?

asked 2019-05-03 08:20:50 -0600

streamhada gravatar image

updated 2019-05-03 09:54:57 -0600

metadaddy gravatar image

Hi

I am trying to do a data tranformation with the Jython Evaluator Processor, the problem i am facing is that :

record.value['http']['results'][ind]['study'][i]['level']

this line of code is working fine if in the data I am receiving I have the column "Level", and it failing when it s not received.

How can i check if the column "Level" exist before calling it ?

Thank You saad

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-05-03 09:51:05 -0600

metadaddy gravatar image

You can test for the existence of a field with in:

if 'level' in record.value['http']['results'][ind]['study'][i]:
    do_something;
edit flag offensive delete link more

Comments

Perfect , it s working thank you a lot

streamhada gravatar imagestreamhada ( 2019-05-03 10:24:55 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-05-03 08:20:50 -0600

Seen: 290 times

Last updated: May 03