Function in For Next Loop

Hello

use a function in a For next loop, the loop does not wait until the function returns the value. I don’t understand. I mainly program with vb.net in Visual Studio, where the loop is interrupted when the function is called. What should I take into account? the loop breaks at:

Uncaught TypeError: Cannot read properties of undefined (reading ‘coinpair’)

→ without the function the error does not occur.

Here is my Code:

For lintLoop = 0 To UBound(lDynCoinList)
      If Not IsNull(CStr(lDynCoinList[lintLoop].coinpair)) Then
        'console.log(CStr(lDynCoinList[lintLoop].coinpair))
        If CStr(lDynCoinList[lintLoop].coinplatform) = "MexC" Then
          lintArrayIndex = Get_Array_Index(lDynCoinMexC, CStr(lDynCoinList[lintLoop].coinpair))
          If lintArrayIndex <> -1 Then
            console.log(CStr(lintArrayIndex))
            lstrAktuellerKurs = CStr(lDynCoinMexC[lintArrayIndex].price)
          End If  
        End If
        
        CoinList.addItem(CStr(lDynCoinList[lintLoop].coinpair) & "  /  " & lstrAktuellerKurs)
      End If
    Next 

Function Get_Array_Index(lDynCoin, lstrCoinName)
  For lintLoop = 0 To UBound(lDynCoin)
    'console.log(lDynCoin[lintLoop]["symbol"])
    If UCase(CStr(lDynCoin[lintLoop].symbol)) = UCase(lstrCoinName) Then
      Get_Array_Index = lintLoop
      Exit Function
    End If
  Next
  Get_Array_Index = -1
End Function

kind regards

ramon

Tip : If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)

  1. Which statement is it flagging with that error?

  2. Have you checked the values of all the interim values? I don’t see any asynchronous functions here, so it seems to be something in your code.

Uncaught TypeError: Cannot read properties of undefined (reading ‘coinpair’)
at Button2.onclick (code.js:44:54)

Hello George

for the async function i need the newest App Studio Version?Right, i have still V 6.3.1.4. Can i have a upgrade with my key?

thanks for your answer

ramon

I’m not sure I understand your question here.

Version 6.3.1.4 is many years old and no longer supported. You can get the latest version (9.0.2) here.

Hello

Is the price for 99$ still available with my Key. I can’t find it on the Website.

Freundliche Grüsse

Ramon Diriwächter

MetallDesign

Seebergstr. 1

8952 Schlieren

Mail: info@metall-design.ch

Web: www.metall-design.ch

Fon: +41 79 7494942

Your best bet the Essential Plan for $15/month subscription. You can also get Pro plan which has extra support.

Let me know if you have questions!