
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2023 01:25 AM
Hi,
I'm stuck on a pattern development solution which can't be that hard, surely?
I have a table as a result of parsing a config file in which the first rows fields contain default values and all subsequent rows may or may not be populated. If there is a value I need to keep that value, but if there isnt I need to overwrite that empty field with the first rows default value. E.g.
Start point
Col1 | Col2 | Col3 | |
Default | O | OO | OOO |
Row1 | a | b | |
Row2 | x | y |
End point
Col1 | Col2 | Col3 | |
Default | O | OO | OOO |
Row1 | a | OO | b |
Row2 | O | x | y |
I've so far attempted Transform Table with javascript field transforms along the lines of
var rtrn = '';
var defVal = ${config[1].Field1};
var currentVal = ${config[].Field1};
if (defVal && !currentVal )
{
rtrn = defVal;
}
but when there is a default value this creates empty fields where there were values before and where there isnt a default value but there is a row value, it empties all values.
Argh.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 09:27 PM
Turns out to be simple, wish I could say deceptively simple, but its not deceptive, just simple. Or perhaps thats me. Anyway.
You just need to Transform Table to a new interim table (or your CI table) using a Javascript switch in the Value field for each attribute you want to set. Pretty similar to what I was trying before, but this version works.
var rtn;
if (${config[].Active})
{rtn = ${config[].Active}}
else
{if (${config[1].Active})
rtn = ${config[1].Active}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 09:27 PM
Turns out to be simple, wish I could say deceptively simple, but its not deceptive, just simple. Or perhaps thats me. Anyway.
You just need to Transform Table to a new interim table (or your CI table) using a Javascript switch in the Value field for each attribute you want to set. Pretty similar to what I was trying before, but this version works.
var rtn;
if (${config[].Active})
{rtn = ${config[].Active}}
else
{if (${config[1].Active})
rtn = ${config[1].Active}
}