YUI DataTable custom sortFunction issue - javascript

I am using a YUI DataTable with a custom sortFunction that strips out HTML code, to sort based on the text content only, rather than the entire string with HTML tags. The problem that I am having is that I need to make use of this sort function on three different columns, and I can not seem to pass the "field" value into my sort function. I want to use "field" rather than naming the column - because I would like to use the same sort function for all three columns rather than repeat it three times as I have in the code below. When I pass in "field" the sort stalls or hangs in the browser and "field" seems to be "undefined". Any ideas?
YAHOO.util.Event.addListener(window, "load", function() {
var sortProject = function(a, b, desc) {
var col = "project";
// Deal with empty values
if(!YAHOO.lang.isValue(a)) {
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
}
else if(!YAHOO.lang.isValue(b)) {
return -1;
}
var comp = YAHOO.util.Sort.compare;
var tagregex = /<[^>]*>/g;
var aString = a.getData(col).replace(tagregex, "");
var bString = b.getData(col).replace(tagregex, "");
var compString = comp(aString, bString, desc);
return compString;
};
var sortArchitect = function(a, b, desc) {
var col = "architect"
// Deal with empty values
if(!YAHOO.lang.isValue(a)) {
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
}
else if(!YAHOO.lang.isValue(b)) {
return -1;
}
var comp = YAHOO.util.Sort.compare;
var tagregex = /<[^>]*>/g;
var aString = a.getData(col).replace(tagregex, "");
var bString = b.getData(col).replace(tagregex, "");
var compString = comp(aString, bString, desc);
return compString;
};
var sortStatus = function(a, b, desc) {
var col = "status"
// Deal with empty values
if(!YAHOO.lang.isValue(a)) {
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
}
else if(!YAHOO.lang.isValue(b)) {
return -1;
}
var comp = YAHOO.util.Sort.compare;
var tagregex = /<[^>]*>/g;
var aString = a.getData(col).replace(tagregex, "");
var bString = b.getData(col).replace(tagregex, "");
var compString = comp(aString, bString, desc);
return compString;
};
var myColumnDefs = [
{key:"design",label:"<span class='dtTitleText'>Design</span>", width:105, formatter:YAHOO.widget.DataTable.formatDate, sortable:true},
{key:"status",label:"<span class='dtTitleText'>Status</span> <sup>1</sup>", sortable:true, width:62, sortOptions:{sortFunction:sortStatus}},
{key:"project",label:"<span class='dtTitleText'>Project Name</span>", sortable:true, width:105, sortOptions:{sortFunction:sortProject}},
{key:"address",label:"<span class='dtTitleTextNoSort'>Address</span>", width:80, sortable:false},
{key:"city",label:"<span class='dtTitleText'>City</span>", width:80, sortable:true},
{key:"state",label:"<span class='dtTitleText'>State</span>", width:45, sortable:true},
{key:"type",label:"<span class='dtTitleText'>Building <br />Type</span>", width:75, sortable:true},
{key:"feet",label:"<span class='dtTitleText'>Gross <br />Sq. Ft.</span>", width:55, formatter:YAHOO.widget.DataTable.formatNumber,sortable:true},
{key:"owner",label:"<span class='dtTitleText'>Building <br />Owner</span>", width:95, sortable:true},
{key:"architect",label:"<span class='dtTitleText'>Architect of <br />Record (AOR)</span>", width:115, sortable:true, sortOptions:{sortFunction:sortArchitect}}
];
var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("storableTable"));
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
myDataSource.responseSchema = {
fields: [{key:"design", parser:"number"},
{key:"status"},
{key:"project"},
{key:"address"},
{key:"city"},
{key:"state"},
{key:"type"},
{key:"feet", parser:"number"},
{key:"owner"},
{key:"architect"}
]
};
var myDataTable = new YAHOO.widget.DataTable("progEnhanceTable", myColumnDefs, myDataSource,
{sortedBy:{key:"design",dir:"desc"}, renderLoopSize: 50}
);
return {
oDS: myDataSource,
oDT: myDataTable
}; });

How about generating the sort functions in a function:
function makeSortFunction(col) {
return function(a, b, desc) {
// NOTE: the passed 'col' variable is available inside closure...
// Deal with empty values
if(!YAHOO.lang.isValue(a)) {
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
}
else if(!YAHOO.lang.isValue(b)) {
return -1;
}
var comp = YAHOO.util.Sort.compare;
var tagregex = /<[^>]*>/g;
var aString = a.getData(col).replace(tagregex, "");
var bString = b.getData(col).replace(tagregex, "");
var compString = comp(aString, bString, desc);
return compString;
};
}
And use it as
{key:"status",label:"<span class='dtTitleText'>Status</span> <sup>1</sup>", sortable:true, width:62, sortOptions:{sortFunction:makeSortFunction('status')}},
{key:"project",label:"<span class='dtTitleText'>Project Name</span>", sortable:true, width:105, sortOptions:{sortFunction:makeSortFunction('project')}},
Rather than referring to the function, this is calling makeSortFunction(), which returns the actual sort function.

Related

Sum Values in Object

I am trying to sum values from a report in GoogleAdsScript.
The report has to be segmented by campaignName, because of filter criteria.
The results should show aggregated values for IDs that exist in multiple campaigns.
I have managed to transform the report into an array and group by ID.
The last step would be to sum the values for each ID, as the GroupBy function I am using is not doing this.
Here's what I got so far:
function main() {
var report = generateReport();
Logger.log(groupBy(reportArray, "Id"));
}
function generateReport() {
var report;
var accountSelector = MccApp.accounts()
.withIds(['123-456-7890']);
var accountIterator = accountSelector.get();
while (accountIterator.hasNext()) {
var account = accountIterator.next();
MccApp.select(account);
report = AdsApp.report('SELECT segments.product_item_id, metrics.cost_micros, metrics.conversions_value, campaign.name, metrics.conversions, segments.product_custom_attribute4, segments.product_custom_attribute3, segments.product_custom_attribute2, segments.product_custom_attribute1 FROM shopping_performance_view WHERE campaign.name REGEXP_MATCH ".*_PPF_.*" AND campaign.name NOT REGEXP_MATCH ".*_PPF_Y.*" AND metrics.cost_micros > 50000000 AND segments.date DURING LAST_30_DAYS ORDER BY segments.product_item_id ASC');
}
return report;
}
function formatMicros(value) {
const micros = parseFloat(value / 1000000).toFixed(2);
return `${micros}`;
}
var groupBy = function(xs, key) {
return xs.reduce(function(rv, x) {
(rv[x[key]] = rv[x[key]] || []).push(x);
return rv;
}, {});
};
function reportToArray (report){
var array = [];
var rows = report.rows();
while (rows.hasNext()) {
//Relevante Variablen erstellen
var row = rows.next();
var campaignName = row["campaign.name"];
var offerId = row["segments.product_item_id"];
var conversionValue = row["metrics.conversions_value"];
var cost = formatMicros(row["metrics.cost_micros"]);
var conversions = row["metrics.conversions"];
var rowObject = {Kampagne:campaignName, Id:offerId, ConversionValue:conversionValue, Cost:cost, Converisons:conversions};
array.push(rowObject);
}
return array;
}
The result from the Logger.log look like this if the IDs are only present in one campaign:
{12345=[{Kampagne=SampleCampaignName1, Id=12345, Cost=84.68, Converisons=2.365506, ConversionValue=101.07449979}],
23456=[{Kampagne=SampleCampaignName1, Converisons=15.14796, Id=23456, ConversionValue=730.58781899, Cost=120.72}],
34567=[{ConversionValue=1185.87613113, Cost=108.33, Kampagne=SampleCampaignName1, Id=34567, Converisons=7.782904}]
And like this, if they are present in multiple campaigns:
45678=[{Kampagne=samplecampaignName1, Converisons=0.0, ConversionValue=0.0, Id=45678, Cost=65.73}, {ConversionValue=2091.72, Cost=77.34, Converisons=4.0, Id=45678, Kampagne=samplecampaignName2}]
How do I sum the values for Cost/ConversionValue/Conversions in this second Case?
Any help is greatly appreciated.
Kind Regards,
Jan
Sorry if I misunderstood the task.
var newArr = [];
class Kampagne {
constructor(Id, ConversionValue, Converisons, Cost) {
this.Id = Id;
this.ConversionValue = ConversionValue;
this.Converisons = Converisons;
this.Cost = Cost;
}};
var array = [
{Kampagne:'samplecampaignName1', Converisons:3.0, ConversionValue:0.0, Id:257680, Cost:65.73},
{ConversionValue:2091.72, Cost:77.34, Converisons:4.0, Id:257680, Kampagne:'samplecampaignName2'},
{ConversionValue:100, Cost:32.04, Converisons:1.0, Id:257681, Kampagne:'samplecampaignName3'}
];
array.forEach(function(element, idx){
let res = newArr.find((e) => e.Id == element.Id);
if(res==undefined) {
newArr.push(new Kampagne(element.Id, element.ConversionValue, element.Converisons, element.Cost));
} else {
res.ConversionValue += element.ConversionValue;
res.Converisons += element.Converisons;
res.Cost += element.Cost;
}
});
console.log(newArr);

Get variables from URL and convert to array

I need to retrieve variables from an URL.
I use this found function:
function getParams(str) {
var match = str.replace(/%5B/g, '[').replace(/%5D/g, ']').match(/[^=&?]+\s*=\s*[^&#]*/g);
var obj = {};
for ( var i = match.length; i--; ) {
var spl = match[i].split("=");
var name = spl[0].replace("[]", "");
var value = spl[1];
obj[name] = obj[name] || [];
obj[name].push(value);
}
return obj;
}
var urlexample = "http://www.test.it/payments/?idCliente=9&idPagamenti%5B%5D=27&idPagamenti%5B%5D=26"
var me = getParams(stringa);
The output is:
{"idPagamenti":["26","27"],"idCliente":["9"]}
But idCliente is always NOT an array, so i'd like to retrieve:
{"idPagamenti":["26","27"],"idCliente": 9 }
This is the fiddle example
function getParams(str) {
var match = str.replace(/%5B/g, '[').replace(/%5D/g, ']').match(/[^=&?]+\s*=\s*[^&#]*/g);
var obj = {};
for ( var i = match.length; i--; ) {
var spl = match[i].split("=");
var name = spl[0].replace("[]", "");
var value = spl[1];
obj[name] = obj[name] || [];
obj[name].push(value);
}
return obj;
}
var stringa = "http://www.test.it/payments/?idCliente=9&idPagamenti%5B%5D=27&idPagamenti%5B%5D=26"
var me = getParams(stringa);
$(document).ready(function(){
alert("testing");
console.log(me);
$(".a").html(JSON.stringify(me));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="a">
</div>
Someone can help me to modify code?
I think your facing a real paradigm problem. Why idCliente wouldn't be an array but idPagamenti would be. You should have all array or none but not both. getParams() function can make this choice for you and you should probably change the way you are working with this.
Anyway, here is a getParams() function that replace any single-valued array to a value. Note that if you have only one idPagamenti in your URI, you will also have a single value for idPagamenti instead of an array.
function getParams(str) {
var match = str.replace(/%5B/g, '[').replace(/%5D/g, ']').match(/[^=&?]+\s*=\s*[^&#]*/g);
var obj = {};
for ( var i = match.length; i--; ) {
var spl = match[i].split("=");
var name = spl[0].replace("[]", "");
var value = spl[1];
obj[name] = obj[name] || [];
obj[name].push(value);
}
Object.keys(obj).forEach(key => {
if (obj[key].length === 1) {
obj[key] = obj[key][0];
}
})
return obj;
}
var urlexample = "http://www.test.it/payments/?idCliente=9&idPagamenti%5B%5D=27&idPagamenti%5B%5D=26"
var me = getParams(stringa);
If you know that you will always get ids as parameters, you can also add a parseInt() for each parameter by replacing var value = spl[1]; with var value = parseInt(spl[1], 10);

Javascript: group JSON objects using specific key

I have the following JSON object and wanted to merge them by OrderID, making the items into array of objects:
[
{
"OrderID":"999123",
"ItemCode":"TED-072",
"ItemQuantity":"1",
"ItemPrice":"74.95",
},
{
"OrderID":"999123",
"ItemCode":"DY-FBBO",
"ItemQuantity":"2",
"ItemName":"DOIY Foosball Bottle Opener > Red",
"ItemPrice":"34.95",
}
]
and I'm wondering how in Javascript to merge the items on the same order...like this:
[{
"OrderID": "999123",
"Items": [{
"ItemCode": "DY-FBBO",
"ItemQuantity": "2",
"ItemName": "DOIY Foosball Bottle Opener > Red",
"ItemPrice": "34.95"
}, {
"ItemCode": "TED-072",
"ItemQuantity": "1",
"ItemName": "Ted Baker Womens Manicure Set",
"ItemPrice": "74.95"
}]
}]
I suggest you use javascript library like underscorejs/lazyjs/lodash to solve this kind of thing.
Here is the example on using underscorejs:
var data = [{
"OrderID":"999123",
"ItemCode":"TED-072",
"ItemQuantity":"1",
"ItemPrice":"74.95",
}, {
"OrderID":"999123",
"ItemCode":"DY-FBBO",
"ItemQuantity":"2",
"ItemName":"DOIY Foosball Bottle Opener > Red",
"ItemPrice":"34.95",
}]
var result = _.chain(data).groupBy(function (e) {
return e.OrderID;
}).map(function (val, key) {
return {
OrderID: key,
Items: _.map(val, function (eachItem) {
delete eachItem.OrderID;
return eachItem;
})
};
}).value();
Working example:
var data = [{
"OrderID":"999123",
"ItemCode":"TED-072",
"ItemQuantity":"1",
"ItemPrice":"74.95",
}, {
"OrderID":"999123",
"ItemCode":"DY-FBBO",
"ItemQuantity":"2",
"ItemName":"DOIY Foosball Bottle Opener > Red",
"ItemPrice":"34.95",
}];
var result = _.chain(data).groupBy(function (e) {
return e.OrderID;
}).map(function (val, key) {
return {
OrderID: key,
Items: _.map(val, function (eachItem) {
delete eachItem.OrderID;
return eachItem;
})
};
}).value();
document.write(JSON.stringify(result));
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
This should do what you want it to do, but it's rather a group function than a merge function :)
You can see the result in the browser console.
var items = [
{
"OrderID":"999123",
"ItemCode":"TED-072",
"ItemQuantity":"1",
"ItemPrice":"74.95",
},
{
"OrderID":"999123",
"ItemCode":"DY-FBBO",
"ItemQuantity":"2",
"ItemName":"DOIY Foosball Bottle Opener > Red",
"ItemPrice":"34.95",
}
];
function groupBy(ungrouped, groupByProperty) {
var result = [],
getGroup = function (arr, val, groupByProperty) {
var result, j, jlen;
for (j = 0, jlen = arr.length; j < jlen; j++) {
if (arr[j][groupByProperty] === val) {
result = arr[j];
break;
}
}
if (!result) {
result = {};
result.items = [];
result[groupByProperty] = val;
arr.push(result);
}
return result;
}, i, len, item;
for (i = 0, len = ungrouped.length; i < len; i++) {
item = getGroup(result, ungrouped[i][groupByProperty], groupByProperty);
delete ungrouped[i][groupByProperty];
item.items.push(ungrouped[i]);
}
return result;
}
var grouped = groupBy(items, 'OrderID');
document.getElementById('result').innerHTML = JSON.stringify(grouped);
console.log(grouped);
<div id="result"></div>
Lodash is a great Javascript Utility library that can help you in this case. Include the latest version of lodash in your code and group the objects like this:
var mergedOrders = _.groupBy(OriginalOrders, 'OrderID');
It seems you'll have to do a function that, for each entry, will check if it match
try this :
// your array is oldArr
var newArr = []
for (var i=0;i<oldArr.length;i++){
var found = false;
for(var j=0;j<newArr.length;j++){
if(oldArr[i]["OrderID"]==newArr[j]["OrderID"]){
newArr[j]["Items"].push(oldArr[i]);
found=true;
break;
}
if(!found){
newArr.push({"OrderID" : oldArr[i]["OrderID"], "Items" : oldArr[i]});
}
}
You need to loop and create new grouped objects according to your requirement.
For an easier approach I would suggest using jquery-linq
var qOrderIds = $.Enumerable.From(myArray).Select(function(item) { return item.OrderID; }).Distinct();
var groupedList = qOrderIds.Select(function(orderId) {
return {
OrderID: orderId,
Items : $.Enumerable.From(myArray).Where(function(item) { item.OrderID === orderId}).ToArray()
};
}).ToArray();
Thank you for all your answers.
I was able to attain my goal (maybe a bit dirty and not as beautiful as yours but it worked on my end). Hoping this might help others in the future:
function processJsonObj2(dataObj, cfg) {
var retVal = dataObj.reduce(function(x, y, i, array) {
if (x[cfg.colOrderId] === y[cfg.colOrderId]) {
var orderId = x[cfg.colOrderId];
var addressee = x[cfg.colAddressee];
var company = x[cfg.colCompany];
var addr1 = x[cfg.colAddress1];
var addr2 = x[cfg.colAddress2];
var suburb = x[cfg.colSuburb];
var state = x[cfg.colState];
var postcode = x[cfg.colPostcode];
var country = x[cfg.colCountry];
var orderMsg = x[cfg.colOrderMessage];
var carrier = x[cfg.colCarrier];
delete x[cfg.colOrderId];
delete y[cfg.colOrderId];
delete x[cfg.colAddressee];
delete y[cfg.colAddressee];
delete x[cfg.colCompany];
delete y[cfg.colCompany];
delete x[cfg.colAddress1];
delete y[cfg.colAddress1];
delete x[cfg.colAddress2];
delete y[cfg.colAddress2];
delete x[cfg.colSuburb];
delete y[cfg.colSuburb];
delete x[cfg.colState];
delete y[cfg.colState];
delete x[cfg.colPostcode];
delete y[cfg.colPostcode];
delete x[cfg.colCountry];
delete y[cfg.colCountry];
delete x[cfg.colOrderMessage];
delete y[cfg.colOrderMessage];
delete x[cfg.colCarrier];
delete y[cfg.colCarrier];
var orderObj = {};
orderObj[cfg.colOrderId] = orderId;
orderObj[cfg.colAddressee] = addressee;
orderObj[cfg.colCompany] = company;
orderObj[cfg.colAddress1] = addr1;
orderObj[cfg.colAddress2] = addr2;
orderObj[cfg.colSuburb] = suburb;
orderObj[cfg.colState] = state;
orderObj[cfg.colPostcode] = postcode;
orderObj[cfg.colCountry] = country;
orderObj[cfg.colOrderMessage] = orderMsg;
orderObj[cfg.colCarrier] = carrier;
orderObj["Items"] = [ x, y ];
return orderObj;
} else {
var orderId = x[cfg.colOrderId];
var addressee = x[cfg.colAddressee];
var company = x[cfg.colCompany];
var addr1 = x[cfg.colAddress1];
var addr2 = x[cfg.colAddress2];
var suburb = x[cfg.colSuburb];
var state = x[cfg.colState];
var postcode = x[cfg.colPostcode];
var country = x[cfg.colCountry];
var orderMsg = x[cfg.colOrderMessage];
var carrier = x[cfg.colCarrier];
var itemCode = x[cfg.colItemCode];
var itemQuantity = x[cfg.colItemQuantity];
var itemName = x[cfg.colItemName];
var itemPrice = x[cfg.colitemPrice];
var item = {};
item[cfg.colItemCode] = itemCode;
item[cfg.colItemQuantity] = itemQuantity;
item[cfg.colItemName] = itemName;
item[cfg.colItemPrice] = itemPrice;
var orderObj = {};
orderObj[cfg.colOrderId] = orderId;
orderObj[cfg.colAddressee] = addressee;
orderObj[cfg.colCompany] = company;
orderObj[cfg.colAddress1] = addr1;
orderObj[cfg.colAddress2] = addr2;
orderObj[cfg.colSuburb] = suburb;
orderObj[cfg.colState] = state;
orderObj[cfg.colPostcode] = postcode;
orderObj[cfg.colCountry] = country;
orderObj[cfg.colOrderMessage] = orderMsg;
orderObj[cfg.colCarrier] = carrier;
orderObj["Items"] = [ item ];
return orderObj;
}
});
return retVal;
}

Sorting array of object by specific key

I have these object :
var obj1 = {
endDateInMs : 125000001
};
var obj2 = {
endDateInMs: 125000000
};
var obj3 = {
endDateInMs: 125000002
};
and an array containing these objects :
var array1 = [obj1, obj2, obj3];
I would like to sort array1 by date of object. I would like to have the more recent first and the oldiest at the end of the array.
I do the following but it does'nt work :
function compare(a,b) {
if (a.endDateInMs < b.endDateInMs) {
return -1;
}
else if (a.endDateInMs > b.endDateInMs) {
return 1;
}
}
var arrayOfHistoryForThisItem = wall_card_array[item];
var newArraySorted = arrayOfHistoryForThisItem.sort(compare);
var lastElement = newArraySorted[0];
Wouldn't it be just
array1.sort(function(a, b) {
return b.endDateInMs - a.endDateInMs;
});
FIDDLE
Using the open source project http://www.jinqJs.com, its easy.
See http://jsfiddle.net/tford/epdy9z2e/
//Use jsJinq.com open source library
var obj1 = {
endDateInMs : 125000001
};
var obj2 = {
endDateInMs: 125000000
};
var obj3 = {
endDateInMs: 125000002
};
var array1Ascending = jinqJs().from(obj1, obj2, obj3).orderBy('endDateInMs').select();
var array1Descending = jinqJs().from(obj1, obj2, obj3).orderBy([{field:'endDateInMs', sort:'desc'}]).select();
document.body.innerHTML = '<pre>' + JSON.stringify(array1Ascending, null, 4) + '</pre>';
document.body.innerHTML += '<pre>' + JSON.stringify(array1Descending, null, 4) + '</pre>';

To function to string, search and replace function, execute function

I am trying to do something crazy, I have a JSON object of all sorts of rules for my website. I have a system set up where I can write pseudo code and then it turns it into actual code. I have this working perfectly for strings, however now I need to be able to pass functions, and replace the pseudo code inside of functions, then execute the functions.
I think I am on the right track, however when I turn a function to a string it only turns the output of the functions into a string.
Here's my JSON (part of it)
customValidation: {
//compare: "(<!this!> && <!PrimeTimeDiscount!> == 200) || (<!PrimeTimeDiscount!> == 100)",
compare: function(){
return new Validator()["date"]("<!this!>", 50);
},
overrideDefault: true
}
The commented out "compare" is how I use this system for regular strings.
And below is how I handle turning "<!this!>" and "<!*!>" into values from the JSON object. It is basically the same code twice, but the one below I have started modifying for when a function is detected.
if(typeof customValidationRule != "function")
{
var string = customValidationRule.match(/<!(.*?)!>/g);
var customValidationTerms = new Array();
var execCustomValidationRule = customValidationRule;
$.each(string, function(i, v){
var customValidationTerm = v.replace(/<!/g, "").replace(/!>/g, "");
customValidationTerms.push(customValidationTerm);
});
$.each(customValidationTerms, function(i, v){
var RegEx = new RegExp("<!"+v+"!>", "ig");
if(v == "this")
{
var newData = value ? value : "''";
}
else
{
var newData = FormData[parentKey][TermNames[v]] ? FormData[parentKey][TermNames[v]] : "''";
}
newData = dataType == "currency" ? cleanVar(cleanCurrency(newData)) : newData;
newData = newData ? newData : "''";
execCustomValidationRule = execCustomValidationRule.replace(RegEx, newData);
});
}
else
{
var customValidationRuleString = customValidationRule().toString();
var string = customValidationRuleString.match(/<!(.*?)!>/g);
var customValidationTerms = new Array();
var execCustomValidationRule = customValidationRuleString;
$.each(string, function(i, v){
var customValidationTerm = v.replace(/<!/g, "").replace(/!>/g, "");
customValidationTerms.push(customValidationTerm);
});
$.each(customValidationTerms, function(i, v){
var RegEx = new RegExp("<!"+v+"!>", "ig");
if(v == "this")
{
var newData = value ? value : "''";
}
else
{
var newData = FormData[parentKey][TermNames[v]] ? FormData[parentKey][TermNames[v]] : "''";
}
newData = dataType == "currency" ? cleanVar(cleanCurrency(newData)) : newData;
newData = newData ? newData : "''";
execCustomValidationRule = execCustomValidationRule.replace(RegEx, newData);
});
var backToFunction = eval('(' + execCustomValidationRule + ')');
//validation = customValidationRule();
}
validation = eval(execCustomValidationRule);

Categories