APIs & Integrations

patrickhummel
Mitwirkender/Mitwirkende

HubDB multiple listing of else information

lösung

Hello community Smiley Happy

Perhaps somebody can help me… I have got a problem with my else condition:

https://codeshare.io/5NjJZ1

At the end, I get multiple error message: "Keine Veranstaltung…"
Example: http://sorba-2753787.hs-sites.com/events-test

How do I have to modify the code to see my created error message just once.
I tried to put the if and else condition above the table row definition, but then nothing happens…

0 Upvotes
1 Akzeptierte Lösung
Derek_Gervais
Lösung
HubSpot-Alumnus/Alumna
HubSpot-Alumnus/Alumna

HubDB multiple listing of else information

lösung

Hi @patrickhummel,

The reason that error message is printing multiple times is because it appears in the for loop. The code within the loop will execute once for each row in table, so that error will be printed once each time that if statement fails. To only print it once, you’d need it to appear outside of the for loop.

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
1 Antwort
Derek_Gervais
Lösung
HubSpot-Alumnus/Alumna
HubSpot-Alumnus/Alumna

HubDB multiple listing of else information

lösung

Hi @patrickhummel,

The reason that error message is printing multiple times is because it appears in the for loop. The code within the loop will execute once for each row in table, so that error will be printed once each time that if statement fails. To only print it once, you’d need it to appear outside of the for loop.

0 Upvotes