Cos sin function and strings passed from firbase

To whom this may concern

I have a problem passing a string value from firebase to a cos and sin algorithm. There is a fault where the description is "the operation expt cannot accept the arguement {false]. I have found that the passing from firebase to variable works fine, but it does not work when i want to use the cos and sin calculation. I have tried to change it from a string value to a number value in all ways displayed in the community. Anyone have an idea what is wrong?

JK

Please show your relevant blocks and firebase console data

This looks odd, though....

I knew you would say that but the code is rather big. I is found on the right side under button 26 and variable 5-8.

JK

Please download and post each of those event block(s)/procedures here ...
P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See Download Block Images for a demo.

Don't make us take out the microscope.

I only asked for your relevant blocks.....

Which block/s set the value you want to upload to firebase, and what is that value?
What does this look like in the firebase console?
What does it look like when you getValue from Firebase in the app?

I cant make anything but an image of the whole thing.

But i can explain the look.
The insertion is the same as i have done before with a string in and out of firebase. I have secured that the right number goes through so the problem is not on that end. The cos and sin sinus functions is used to find all the geolocations withiin a certain range.
d = acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))
where d is the distance and lat 1/2 and lon 1/2 are the 2 geolocations. In time i will run this from the app getting the geolocations from the firebase.
This is the data in the firebase console.

I have verified the geolocations goes through but they are passed as strings. The problem is converting them to numbers as the cos and sin only accepts numbers. I have as you can see tried via variables to change them to numbers but without luck. I have written them to labels without luck. I have found a page in the community where they show a blue block called value connecthed to the string converting it aparently , but this block has not been possible to find. Is there a way to change the string value transferred to a number that can enter pass the cos sin.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Ok i have made a screen shot of the most relevant block. The center of it is the block called button26.

I want the button clicked to recieve a distance from the tiny db. Together with geolocations from geolocator and a firebase geolocation find the geolocation wirthin the diatance limit.
I will post the positive ones in a listview via a list. At the monent i will only search data8 from the database, but with at while test i will test alle geolocations in the firebase db.

JK

For your first problem:

image

Assume the string value in "global coords" is what comes back in gotValue from Firebase:
Split to a list
Select each list item as lat and lon

Works fine. Changed just the strings on variabel 5 and 6 to numbers.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.