Hi team
i have column
request_param:
0:
a : “11”
b: “12”
c: “12”
d: “12”
how i can get count if above request has 4 parameter it can have 3 also like below
request_param:
0:
a : “11”
b: “12”
c: “12”
based on count i need to hit diff url
Hi team
i have column
request_param:
0:
a : “11”
b: “12”
c: “12”
d: “12”
how i can get count if above request has 4 parameter it can have 3 also like below
request_param:
0:
a : “11”
b: “12”
c: “12”
based on count i need to hit diff url
Kindly provide me the sample data ,so i can try to get the number of parameters in it.
first request -
request_param:
0:
a : “11”
b: “12”
c: “12”
d: “12”
second request -
request_param:
0:
a : “11”
b: “12”
c: “12”
If the request_param is a map , can you please try to get the size of the map using size(request_param) in expression evaluator.
If you can provide me the actual parameter ,so i can try to help you.
The above parameters seems like dummy one but i want the json data which will help me to reproduce the issue.
You also can try to get the size of the map in jython evaluator and proceed further.
Thanks & Regards
Bikram_
Please flatten the nested json and use the below code to get the parameter count in your pipeline.
#newRecord = sdcFunctions.createRecord('header')
val = ''
## Sample Jython code
for record in sdc.records:
try:
count = 0
for key in record.value:
count += 1
record.value = {"txt":count}
sdc.output.write(record)
# Write record to processor output
except Exception as e:
# Send record to error
sdc.error.write(record, str(e))
sdc.output.write(recor
You can use Expression Evaluator.
${ length( record:value('/f1'))}
If field f1 holds 4 values then the above expression will return 4.
as
or use length if you want to count number of items in a LIST
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.