"Export Function button1_click" Not functioning

Hello all,
I am trying to figure out how to fix the functionality of my page. Here is my page code:

import  {getVINInfo}  **from**  'backend/VINModule'; 

$w.onReady( **function**  () { 
//TO DO: Write Your Page Related Code Here 

}); 
export function  button1_click(event) { 
//Add your code for this event here: 
             getVINInfo($w("#vininput").value) 
               .then(vin => { 
                     $w("#results").text  =  "vehicleID: " + vin[0].vehicleID + "\n"  
                                           + "serialNumber: " + vin[0].serialNumber + parseInt("vehicleID".substr(11, 16), 10) + "\n" //260443 
                                           + "worldID: " + vin[0].worldID + "vehicleID".substring(0, 3) + "\n" //4YD 
                                           + "type: " + vin[0].type + "vehicleID".charAt(3) + "\n" // T 
                                           + "kModel: " + vin[0].kModel + "M-" + "vehicleID".substring(4, 7) + "\n" //259 
                                           + "kYear: " + vin[0].kYear + "vehicleID".charAt(9) + "\n" // 
                                           + "modelYear: " + vin[0].ModelYear + "\n"  
                                           + "make: " + vin[0].Make + "\n"  
                                           + "series: " + vin[0].Series + "\n"  
                                           + "series2: " + vin[0].Series2 + "\n"  
                                           + "model: " + vin[0].Model + "\n"  
                                           + "bodyClass: " + vin[0].BodyClass + "\n"  
                                           + "trailerType: " + vin[0].TrailerBodyType + "\n"  
                                           + "trailerType1: " + vin[0].TrailerType + "\n"  
                                           + "str: " + vin[0].str + "modelYear" + " " + "make".toUpperCase() + " " + "series".toUpperCase() + " " + "series2".toUpperCase() + " " + "model".toUpperCase() + " " + "cc" + " " + "trailerType".toUpperCase() + " " + "trailerType1".toUpperCase() + " " + "trailerLength" // combine all elements into string 
                                           + "str1: " + vin[0].str1 + "str".replace(/\,/g, "") //remove commas 
                                           + "str2: " + vin[0].str2 + "str1".split(' ') // turn string into array 
   }); 
} 

I am not sure of why the button is not working and appreciate any feedback given!

Kind regards,
Brittani

Check the properties panel to make sure it’s connected to the onClick function.
If it is connected, try to console.log(“something”) to check if button1 works.

Thanks J.D. ! I have fixed my parsing errors and am now trying to figure out how to produce my results as an array. Can you help? Here is my code:

@tsuyoidesigns sorry, but I don’t understand what you’re trying to achieve. You should add some details. Also maybe you can paste you’re code in the message body (inside a code block) and not as screenshot.

@jonatandor35 I would like for my results to show in an array string but am unable to figure out how to do so.
Here is the code:

$w(“#results”).text = ${VINInfo.Results};

@tsuyoidesigns , first of all, you’re trying to assign the results to a text property, but only strings can be assigned to text property and not arrays.
Second, I don’t know your results structure and you didn’t describe it, so I can’t help you with that.
More details are needed.

@jonatandor35 Here is my issue: I would like the results to change from [object Object] to the Variable shown in the Developer Console.

@tsuyoidesigns , To tell the truth, the image you pasted is of low quality and I can barley see what is in it.
If I’m not wrong:

  1. You have a “results” array.

  2. each of the array elements is an object.

  3. Each of the objects has 4 properties: Value, ValueId, Variable, VariableId.
    Now, I’m not sure what exactly you’d like to have, but let’s say you want a new array that each of its elements is a string of the corresponding object properties.
    So to do that you should use the Javascript forEach method to push the object properties as a string to a new array.
    Something like that:

let processedArray = [];
results.forEach(function(element) {
processedArray.push(`${element.Value} ${element.ValueId} ${element.Variable}         ${element.VariableId}`);
})
console.log(processedArray);

@jonatandor35 @tsuyoidesigns If you only want to see the contents of any array or object returned from a collection then the easiest thing to do is use the JSON.stringify() function like so:

$w('#results').text = `${JSON.stringify(VINInfo.Results)}`;

This will show the Array and the objects in the array with the related key value pairs.
Cheers
Steve

@stcroppe Good morning Steve,
I made the change you suggested and it works! Now I need to figure out how to pull specific results from the array to display.