# dbInputTable no records

**URL:** <https://forum.cloverdx.com/t/dbinputtable-no-records/725>\
**Category:** CloverDX Platform\
**Created:** [June 28, 2010, 12:00am UTC](https://forum.cloverdx.com/t/dbinputtable-no-records/725 "2010-06-28T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnrickner](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@dnrickner](https://forum.cloverdx.com/u/dnrickner)\
**Post date:** [June 28, 2010, 12:00am UTC](https://forum.cloverdx.com/t/dbinputtable-no-records/725/1 "2010-06-28T00:00:00Z")

</div>

Hi,  
I’m needing to do do some action based on whether or not a query produces results. So if I have results, do A, otherwise do B. Problem is that if no results are returned, I can’t seem to capture that information on the next node to do my branching. How would I do this?

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [June 29, 2010, 8:26am UTC](https://forum.cloverdx.com/t/dbinputtable-no-records/725/2 "2010-06-29T08:26:10Z")

</div>

Hello dnrickner,  
it can be hacked by adding a Reformat with following code after the DBInputTable:

```auto
//#CTL1
int counter = 0;
// Transforms input record into output record.
function transform() {
	counter++;
	$0.* := $0.*;
	return 0
}

function finished(){
	dict_put_str("rec_no",num2str(counter));
}

```

This Reformat just counts the input records and sends them to output port. After all records are processed it puts number of processed records to the dictionary. In the subsequent phase, you can get the value from dictionary and, depending on the value, do A or B, eg. in DataGenerator:

```auto
function generate() {
	int rec_no;
	rec_no = str2num(dict_get_str("rec_no"));
	$field := iif(rec_no == 0, "no records processed", "number of processed records: " + rec_no);
	return 0
}

```

---

<div class="post-metadata">

**Author:** ![dnrickner](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@dnrickner](https://forum.cloverdx.com/u/dnrickner)\
**Post date:** [June 29, 2010, 2:15pm UTC](https://forum.cloverdx.com/t/dbinputtable-no-records/725/3 "2010-06-29T14:15:06Z")

</div>

Thank you. This is working.
