Javascript not working in the Intuiface converter


#1

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


#2

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.


#3

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