cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting last entry from ResultList in an udf

vinaymittal
Contributor
0 Kudos

Hi ,

Please tell me how can i remove the last entry in the ResultList variable result,

i have a scenario where i need to remove the last value in the result variable ONLY after the udf has completed execution is there any method like result.delete() etc or maybe result.delete(i)

Please Help

Regards

Vinay

Accepted Solutions (1)

Accepted Solutions (1)

sahithi_moparthi
Contributor
0 Kudos

Hi,

Use CollapseContext after UDF,it will give only the first values in the context.

Answers (3)

Answers (3)

former_member186851
Active Contributor
0 Kudos

Hello Vinay,

Use the below UDF to remove the last Value in the queue/Context.


vinaymittal
Contributor
0 Kudos

Hi Raghuram,

Thanks for your reply, i can do that even in the same code by taking an array list at first and then transferring all its values to the final result variable , but i was looking for something more compact.

Regards

Vinay

yeeloon-khoo
Explorer
0 Kudos

Hi Vinay,

ResultList only have these 3 add and 1 clear function, nothing similar like result.delete(i) or result.remove(i) that you asked. So, previous solution by others above should be compact enough and nothing more compact could be achieved.

addContextChange()

addSuppress()

addValue(Object value)

clear()

Reference:

ResultList

Regards,

Yee Loon

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Vinay,

AFAIK, there is no method for the ResultList class to achieve this.

I think you need to handle this in the udf where the result variable is getting populated by either putting a clause when it is the last value execution etc.

Let us know providing proper screenshots if you are having any issues.

Regards

former_member181985
Active Contributor
0 Kudos

Hi,

I think you can handle the same with some logic within your current UDF i.e., don't add the last value to ResultList object

Else if you have an obvious reason you can't omit last value for some XXX reason in current UDF, create one another UDF to iterate over your current UDF output and ignore last record when you are generating new resultlist

Br,

Praveen