# Loading all records of a Lookup Table in Custom Java Transformer

**URL:** <https://forum.cloverdx.com/t/loading-all-records-of-a-lookup-table-in-custom-java-transformer/1743>\
**Category:** CloverDX Platform\
**Created:** [April 12, 2016, 12:00am UTC](https://forum.cloverdx.com/t/loading-all-records-of-a-lookup-table-in-custom-java-transformer/1743 "2016-04-12T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pareshjoshi](https://avatars.discourse-cdn.com/v4/letter/p/7cd45c/32.png) [@pareshjoshi](https://forum.cloverdx.com/u/pareshjoshi)\
**Post date:** [April 12, 2016, 12:00am UTC](https://forum.cloverdx.com/t/loading-all-records-of-a-lookup-table-in-custom-java-transformer/1743/1 "2016-04-12T00:00:00Z")

</div>

Hi,  
I have created a custom java transformer and want to read all the data from a look up table.

In the graph, I first populate look up table from an excel sheet. It has 3 records and I confirmed that all the 3 records exists in look up table. However in my java code, I can only see one record when I try to read it.

The Key for look up table is called “Key” field and has 0 as value in all 3 records. Here is my Java code

```auto

	private void loadAllLookUpRecords() {
		try {
			System.out.println("Loading loadAllLookUpRecords");

			LookupTable lt;
			lt = getGraph().getLookupTable(LOOKUP_TABLE_ID);
			DataRecord patternRecord = DataRecordFactory.newRecord(lt
					.getMetadata());
			patternRecord.getField(0).setValue(0);
			String[] lookupFields = { "Key" };
			RecordKey recordKey = new RecordKey(lookupFields, lt.getMetadata());

			Lookup lookup;
			lookup = lt.createLookup(recordKey, patternRecord);

			lookup.seek();
			System.out.println("lookup Size :: " + lookup.getNumFound());

			while (lookup.hasNext()) {
				System.out.println("Look up records Found");
				DataRecord record = lookup.next();
				allLookupDataRecords.add(record);
			}
			System.out.println("AllLookUpRecords Size :: " + allLookupDataRecords.size());

		} catch (Exception ex) {
			throw new JetelRuntimeException(ex);

		}
	}
	

```

lookup.getNumFound() always returns 1 record. I will really appreciate if someone can point in right direction to load all data from lookup table. Thanks, Paresh

---

<div class="post-metadata">

**Author:** ![PedroVazquezRosario](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@PedroVazquezRosario](https://forum.cloverdx.com/u/PedroVazquezRosario)\
**Post date:** [April 18, 2016, 5:28pm UTC](https://forum.cloverdx.com/t/loading-all-records-of-a-lookup-table-in-custom-java-transformer/1743/2 "2016-04-18T17:28:06Z")

</div>

Hi,

Could you please tell me what kind of LookUp Table you are utilizing? If it’s a _Simple lookup table_, please make sure to check if the _Allow key duplicates_ is enabled in your lookup table settings.

Regards,

- [^60F7584418840E7380AEA521390CA2993C6B35926D5C102F28^pimgpsh\_thumbnail\_win\_distr.jpg](https://cdn.cloverdx.com/forum/18200%5F97c03270a1ebdf7fcb51f9de26fccf22/60F7584418840E7380AEA521390CA2993C6B35926D5C102F28pimgpsh%5Fthumbnail%5Fwin%5Fdistr.jpg)

---

<div class="post-metadata">

**Author:** ![pareshjoshi](https://avatars.discourse-cdn.com/v4/letter/p/7cd45c/32.png) [@pareshjoshi](https://forum.cloverdx.com/u/pareshjoshi)\
**Post date:** [May 3, 2016, 4:40pm UTC](https://forum.cloverdx.com/t/loading-all-records-of-a-lookup-table-in-custom-java-transformer/1743/3 "2016-05-03T16:40:54Z")

</div>

Hi,  
Thank you. As you suggested just had to check " Allow key duplicates" and that fixed the issue. Thanks
