# Batch Job Report for deleteing same item no. record

**URL:** <https://www.dynamicsuser.net/t/batch-job-report-for-deleteing-same-item-no-record/55281>\
**Category:** Technical Forum\
**Created:** [October 10, 2014, 12:28pm UTC](https://www.dynamicsuser.net/t/batch-job-report-for-deleteing-same-item-no-record/55281 "2014-10-10T12:28:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abuzar\_shaikh](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@abuzar\_shaikh](https://www.dynamicsuser.net/u/abuzar_shaikh)\
**Post date:** [October 10, 2014, 12:28pm UTC](https://www.dynamicsuser.net/t/batch-job-report-for-deleteing-same-item-no-record/55281/1 "2014-10-10T12:28:34Z")

</div>

Dear User,

i have been given a work in which same no of item no. should not come suppose if a user has 1 item no. 1011001002 now other user also have item no 1011001002 so i have to make the report in which that other users particular data should be deleted see the example given below

| User ID | Item No. |
| --- | --- |
| ABHAY | 1011001002 |
| ABOHAR | 1011001002 |
| ADMINISTRATOR | 1011001004 |
| AGRA | 1011001004 |
| AGRA2 | 1011001005 |
| AGRA4 | 1011001007 |
| AJAY | 1011001008 |
| AJEET | 1011001009 |
| AKASH | 1011001009 |
| ALIGARH | 1011001010 |
| ALIGARH2 | 1011001010 |
| ALLAHABAD | 1011001011 |
| AMAN | 1011001012 |
| AMBALA | 1011001013 |
| AMIT\_ACC | 1011001013 |
| AMRITSAR | 1011001014 |
| ANDHRAP | 1011001014 |

---

<div class="post-metadata">

**Author:** ![archer89](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archer89](https://www.dynamicsuser.net/u/archer89)\
**Post date:** [October 10, 2014, 9:51pm UTC](https://www.dynamicsuser.net/t/batch-job-report-for-deleteing-same-item-no-record/55281/2 "2014-10-10T21:51:47Z")

</div>

hi,

try

// table userItemLoc contains the data

IF userItemLoc.FINDSET THEN

REPEAT

IF itemNo = userItemLoc.“Item No.” THEN

userItemLoc.MARK(TRUE)

ELSE

itemNo := userItemLoc.“Item No.”;

UNTIL userItemLoc.NEXT = 0;

userItemLoc.markedonly(true);

userItemLoc.deleteall;

best regards

---

<div class="post-metadata">

**Author:** ![abuzar\_shaikh](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@abuzar\_shaikh](https://www.dynamicsuser.net/u/abuzar_shaikh)\
**Post date:** [October 11, 2014, 6:29am UTC](https://www.dynamicsuser.net/t/batch-job-report-for-deleteing-same-item-no-record/55281/3 "2014-10-11T06:29:30Z")

</div>

Dear Kalchmair,

Thank you for the response i have try this code and it is working fine i will try your solution as well.

MyItem.RESET;

MyItem.SETFILTER(“User ID”,’\<\>%1’,“User ID”);

MyItem.SETRANGE(“Item No.”,“Item No.”);

IF MyItem.FINDFIRST THEN

REPEAT

MyItem.DELETE;

UNTIL MyItem.NEXT = 0;

Best Regards,

Abuzar

---

<div class="post-metadata">

**Author:** ![archer89](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archer89](https://www.dynamicsuser.net/u/archer89)\
**Post date:** [October 11, 2014, 9:16am UTC](https://www.dynamicsuser.net/t/batch-job-report-for-deleteing-same-item-no-record/55281/4 "2014-10-11T09:16:37Z")

</div>

hm,

your code would work if you want to get the records with an User ID different from the current User. if you really want to delete/change items within the loop you should use findfirst(true,false). but give it a try.

regards

frank
