# Any FlowScript functions to check if a Table has a specific column?

**URL:** <https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516>\
**Category:** Flow Classic\
**Tags:** studio-or-server\
**Created:** [October 18, 2023, 12:13pm UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516 "2023-10-18T12:13:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mew](https://avatars.discourse-cdn.com/v4/letter/m/7C9FD7/32.png) [@mew](https://forum.novacura.com/u/mew)\
**Post date:** [October 18, 2023, 12:13pm UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/1 "2023-10-18T12:13:59Z")

</div>

Is there a standard way to check if a Table has a specific column or not? We have a situation where Input table for a Datasource workflow has different sources, which can give different number of attributes.  
We are current using the functions to convert the table to JSON, then doing a text search to see if the Table includes the attribute or not. Was wondering if there was a better way to do this?

---

<div class="post-metadata">

**Author:** ![OlaCarlander](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/olacarlander/32/205_2.png) [@OlaCarlander](https://forum.novacura.com/u/OlaCarlander)\
**Post date:** [October 19, 2023, 4:05pm UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/2 "2023-10-19T16:05:24Z")

</div>

Hi, Can you describe why the datasource workflow has an input table?  
Or is it an interaction workflow?

---

<div class="post-metadata">

**Author:** ![mew](https://avatars.discourse-cdn.com/v4/letter/m/7C9FD7/32.png) [@mew](https://forum.novacura.com/u/mew)\
**Post date:** [October 20, 2023, 7:11am UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/3 "2023-10-20T07:11:02Z")

</div>

This is a Datasource for a Table Portlet that is listening to input coming from both a Filter Portlet and a process overview portlet. Based on the input, it will output the relevant data.

---

<div class="post-metadata">

**Author:** ![OlaCarlander](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/olacarlander/32/205_2.png) [@OlaCarlander](https://forum.novacura.com/u/OlaCarlander)\
**Post date:** [October 20, 2023, 8:29am UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/4 "2023-10-20T08:29:34Z")

</div>

Ok good, just want to make sure. I know Flow is a bit funky when it comes to null or non-existing values, but could you have a dummy column from each of the “transmitting” portlets that is called Source or something, and when coming from the filter portlet contains ‘F’ and when coming from the other a ‘P’, and then with a decision step in the data source wflow take different paths based on that?

Nothing I have ever tried so it is just an idea that might work

---

<div class="post-metadata">

**Author:** ![mew](https://avatars.discourse-cdn.com/v4/letter/m/7C9FD7/32.png) [@mew](https://forum.novacura.com/u/mew)\
**Post date:** [October 20, 2023, 8:47am UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/5 "2023-10-20T08:47:27Z")

</div>

Hmm. Issue is that I couldn’t find a way to add a dummy column to the filter portlet. Seems any attribute I add is visible. I already have a solution using the Table to JSON conversion. But was wondering if there was a better/more standard way to do this.

---

<div class="post-metadata">

**Author:** ![OlaCarlander](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/olacarlander/32/205_2.png) [@OlaCarlander](https://forum.novacura.com/u/OlaCarlander)\
**Post date:** [October 23, 2023, 2:39pm UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/6 "2023-10-23T14:39:17Z")

</div>

Right, you are coming from the filter portlet. I don’t think there is any standard to that no. Glad that you have found a way that works for you.

---

<div class="post-metadata">

**Author:** ![PvanderHeyden](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/pvanderheyden/32/760_2.png) [@PvanderHeyden](https://forum.novacura.com/u/PvanderHeyden)\
**Post date:** [October 27, 2023, 8:20am UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/7 "2023-10-27T08:20:00Z")

</div>

If the source is Oracle you can ask Oracle like this:

```auto
select c.cname, c.colno, c.tname
from SYS.COL c join SYS.TAB t on t.tname = c.tname
where t.tabtype = 'VIEW' and t.tname = 'PROJECT_CFV' and c.cname = 'ACTUAL_START';

```

---

<div class="post-metadata">

**Author:** ![mew](https://avatars.discourse-cdn.com/v4/letter/m/7C9FD7/32.png) [@mew](https://forum.novacura.com/u/mew)\
**Post date:** [October 30, 2023, 8:13am UTC](https://forum.novacura.com/t/any-flowscript-functions-to-check-if-a-table-has-a-specific-column/516/8 "2023-10-30T08:13:06Z")

</div>

Hi,

The source is a Novacura flow Table, which is coming as a Input variable to a machine flow. Was wondering if there was any flowscript Table functions for this. However, it seems that there isn’t a function that I can use directly.

But I have found a workaround using the JSON.Encode function.

> let l\_tab = Input;  
> let l\_rec = [ATTR1: 1, ATTR2: 0, ATTR3: ‘’, ATTR4: ‘’, ATTR5: ‘’];
> 
> if Any(l\_tab) {  
> set l\_rec = First(l\_tab);  
> let l\_json = JSON.Encode(l\_rec);
> 
> ```
> if InStr(l_json, '"ATTR5"') < 0 {
> set l_rec = [ATTR1: l_rec.ATTR1, ATTR2: l_rec.ATTR2, ATTR3: l_rec.ATTR3, ATTR4: l_rec.ATTR4, ATTR5: 'Default Value'];
> }
> 
> ```
> 
> }
> 
> return l\_rec;
