Webviewer component giving results as undefined

I am trying to identify a duplicate using webviewer component and xmlhttp request. its working fine with html page but giving undefined for MIT app inventor. I broke my head to find the solution for it. could you please give solution. thanks in advance.

Getting undefined in the webviewstring "usually"or "often" means that you are trying to set an object to the webviewstring, instead of a string. Use JSON.stringify or similar.

yes i have sent the encoded object. please see the block picture. i tried with with text also

It is where you set the webviewstring with checkDuplicate

please find highlighted.I have tested at possible places. but could not get the result. it is working fine if i send entire data as json object but failed with xmlhttp request GETmethod

Try setting the webviewstring to a string, such as "hello world" (instead of checkDuplicate), does this get returned to the app?

yes it is working fine. i have set getviewstring to eMail and webviewstring is sending the same to the app.

its working fine with all the data defined in the java code except the data from xmlhttp request GET method. I am worried about the xmlhttp async function. i am feared that code is not allowing sufficient time execute the xmlhttp request. please suggest

It would probably be much easier to write a simple google apps script web app to get the data back from the spreadsheet than doing it your way....

or if a private sheet

or make something up from here:

1 Like

Thank you for your response. Let me tell you frankly i learned and tried all the above methods. Basically i am a mechanical engineer and know very little regarding software technologies.
i heard that coding in apps script will slow down the process. if use gviz method (query), every time we have to go to web.get block and do the rest of the process,! mean time we may need to define many global variables which reduce the speed of application.
Instead if we try with xmlhttp request or fetch method will eliminate the above problems . I am sure lengthy blocks will be get reduced.This is my perception, I am sorry for any wrong statements.

Your source for this ?

If the case, we are probably only talking about a few milliseconds.....

Please see the attachment. I have the coding for my entire project which uses my library functions.

Let me put all the library stuff in code.gs and get it done. Thank you for response.

However, please find a solution for the issue
"its working fine with all the data defined in the java code except the data from xmlhttp request GET method"

may be useful for future projects. I will try with Fetch and Axios if possible .

You do not need to use any libraries for your script.

I have offered that which I believe is the best solution....

Here an example for you (using a spreadsheet with anyone with the link permissions)



Thank you for the information.I have implemented this method for few cases in which further processing is not required. In other cases, i need to check the two dates along with eMail. If condition satisfies, i need to submit the google from using formSubmission which will necessitates calling web1 and using web1 got text.

The whole process is involving with calling web1 and using web1 got text.It may be good to eliminate yellow colored area.

You have choices....

My example simply handles whether there is anything in responseContent or not, what is returned in responseContent is the full record/s found by the query, which you can then use to progress further. Just handle it differently.

If you have to use the same web component to make the form submission, you will need to set up a variable you can set for each web.GET type (e.g. "check", "form") so that you can can apply this variable in the web GOTTEXT block as a test when responseContent is returned.

Otherwise just use a second web component