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?
Hi, Can you describe why the datasource workflow has an input table?
Or is it an interaction workflow?
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.
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
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.
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.
If the source is Oracle you can ask Oracle like this:
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';
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;