Javascript not working in the Intuiface converter

Hi,

My project contains a multi properties development with house and flat, presented in a list through an excel file (data-based). I have all text informations and pictures related in it, plus all informations needed by intuiface to show or not pictures or text (with true / false columns). The client wanted to be able to set any property to sold, not sold, reserved, not reserved through a CMS accessible in the presentation.
I have 2 columns in my excel sheet (1 called Sold, 1 called Reserved), in which I put ā€˜trueā€™ or ā€˜falseā€™ to show the picture related or not (a ā€˜soldā€™ or ā€˜reservedā€™ picture is shown on the property). The CMS that allow the client to show the ā€˜soldā€™ or ā€˜reservedā€™ is simply presented through an asset grid with as many rows as there are properties, and an ā€˜updateā€™ button (that update cells of the excel sheet). I have several columns with the number of the property, the typeā€¦ and a column ā€˜SOLDā€™ and a column ā€˜RESERVEDā€™ in which I have a layer text ā€˜TRUEā€™ or ā€˜FALSEā€™ (because fed from the excel sheet).

Here is my problem: The client doesnā€™t understand the true and false, they wanted to have the text ā€˜SOLDā€™ or ā€˜NOT SOLDā€™ / ā€˜RESERVEDā€™ or ā€˜NOT RESERVEDā€™ instead. So I decided to put a converter on the layer text with a custom script with this PHP code:
if (INPUT == true) { ā€œSOLDā€; }
else { ā€œNOT SOLDā€; }
This code was working properly a month ago, I left the presentation like that, but then intuiface has been updated and the PHP doesnā€™t work anymore. All I have now is all the rows were ā€˜falseā€™ (= I have NOT SOLD and NOT RESERVED), even if the excel sheet as true on some rows. So my data base is working properly, the update button that allows to update cells works also properly but my layer text never change.

So is it a problem within intuiface since the updates, with the PHP that should be written differently or is no longer understood properly? Or is this converter not working for the alteration I want to do with the text, and what can I do instead?

Thank you, and please let me know if more informations are necessary.
E

if (INPUT == true) { ā€œSOLDā€; } else { ā€œNOT SOLDā€; }

My guess: Your excel file has the word true in the column which is a string. Your code checks for ā€œtrueā€ as an undeclared variable, but it should be looking for a string.

It might work if you do:
if (INPUT == ā€œtrueā€) { ā€œSOLDā€; } else { ā€œNOT SOLDā€; }

The quotations change the condition into a string comparison, it looks for the word ā€œtrueā€ rather than a variable called true with a value of 0 or null.
In computer vision, it sees your code as something like:
if (INPUT == 0)
if (INPUT == null)

Also, the Custom Script uses Javascript, which has a different syntax to PHP.

2 Likes

Thanks a lot for your explanation and help!
Now it works :slight_smile: