I’m trying to get Sun calculations, I use custom JS for that, I think I put inputs and outputs, etc. correctly but I can’t get it done, I tried many variations of the code and always get the catch error message.
Could you please check what I am doing wrong, I try many other ways so the app page seems a mess, sorry about that, the particular calculation I am talking about is bound to the Card1 tap,
Thank you @Mari for the reply, I simplified the app-in elements to clear and see better, I want the JS code to work, it is the main idea, it is ready, I think I’m doing wrong in how to call the functions, could you help me run successfully, I tried to do it in many ways, just couldn’t get it,
the app number is up in the previous message, the app URL,
Hey @Juan_Giraldo, I use the plain JS code from the suncalc codes (I gave the GitHub link above), supposedly the functions are there and ready to be called, I try to call with different combinations, but can’t get it right, I tried with different data types, variable varieties, etc. as well, no luck so far,
I’m still not sure what you mean. Looking at the library in GitHub, did you just paste the contents of the suncalc.js file into your custom JS flow function?
Hi @yasin_sahin, sorry I overlooked what you were actually trying to do here – unfortunately it’s not yet possible to use custom libraries in the JS node, but custom plugins are on the development roadmap.
Hi @Mari, the JS code has a bunch of calculations, is there any custom library in the code, I didn’t get fully what you said, you mean “Custom JS” doesn’t run with the code, did you check my app, the code is in the upper button, could you please specify because of what code it wouldn’t run,
@yasin_sahin “Custom JS” means that you can write your own JS code to be run in the app, but you cannot include any external dependencies that are not otherwise included, such as the SunCalc library. The app won’t know how to execute this code. However, as the SunCalc itself doesn’t have any dependencies (it’s just math), you could copy the functions you need into the JS box and use them that way.
@Mari yes, exactly what I am trying to explain, did exactly that, my function call doesn’t work out and/or return the values out, I’d need someone to help me on that, thank you,
Hi, sorry for the misunderstanding We unfortunately don’t have the resources for debugging help, but I suggest you just add the required code piece by piece and just test after each function that it actually works. If you open the Google Chrome debug console (right-click + “Inspect”), you’ll see the error messages that you are getting when running your code, you can also use console.log type debugging into the Chrome console from within your code.
Here’s a quick example of how the inputs / outputs work. If I set input1 to True, I will trigger the first alert, and the 2nd if I set it to False. Pay attention that the output object names match those that you have in your code.