Tuto WINDEV 25

270 Part 4: Full application with data ▶ You can now edit the WLanguage events associated with "BTN_Search". When this control is clicked on, we will run the search procedure found in the component. This procedure: • expects the city name in parameter • returns a string in the following format: Name of customer 1 + TAB + Total sales 1 + CR + Name of customer 2 + TAB + Total sales 2 + ... So, the code of the "Click" event from "BTN_Search" should: • call the GiveOrdersByCity procedure of component while passing the content of EDT_City control in parameter. • process the returned string to add it into the Table control. Write the following WLanguage code: sResultList is string // Gets the list of customers and their orders // for the specified city sResultList = GiveOrdersByCity(EDT_City) // If the list is not empty IF sResultList <> "" THEN // Clears the Table control TableDeleteAll(TABLE_Result) // Browses the results FOR EACH STRING sACustomer OF sResultList SEPARATED BY CR // Adds this client to the Table control TableAdd(TABLE_Result, sACustomer) END ELSE // If the list is empty InfoBuild("No customer found for %1", EDT_City) END ▶ Close the code editor and save your window.

RkJQdWJsaXNoZXIy NDQ0OA==