To get the code to find the Average for 'RQD' in core in Fence

Dear Sir,

I am using gINT V8i version software. we are doing Fence and borehole logs using this. Now I need to find the average for RQD and also this need to be displayed  in the fence.

I manged to display the RQD values in the fence, but unable to find the average. So I request you to help us with the code to find the average for this.

Your reply early will be highly appreciated.

(The reference pics attached for your reference. Kindly check the attached file)