ce icon indicating copy to clipboard operation
ce copied to clipboard

How to use IF function compare string in a json file

Open caotoanbk opened this issue 7 years ago • 1 comments

Hi team, I declared a IF function like

var IF = function(test, then_value, otherwise_value) {
    return test ? then_value : otherwise_value;
};

I want to use json file to store data and i use it to calculate value of a cell like "=IF(K1=="somevalue", 1, 2)" and it doesn't work When I change double quotes to single quote like "=IF(K1=='somevalue', 1, 2)" , it still not working When I escape double quotes by backslash key(\) like "=IF(K1==\"somevalue\", 1, 2)" , it only work when defined in javascript array, when i defined in json file, when loaded, jexcel change to "=IF(K1=="somevalue", 1, 2)" so it's not working. Anyone help me? Thank

caotoanbk avatar Jul 17 '19 07:07 caotoanbk

Sorry, today i test with "=IF(K1==\"somevalue\", 1, 2)" and it works, i don't know.

caotoanbk avatar Jul 18 '19 01:07 caotoanbk