IMDTouchKnowledge BaseShop main store

Troubleshooting

Why RecipeQueryGetData returns no data in EasyBuilder Pro

HMI and touchscreens Published 7 min read By IMDTouch engineering team

Short answer

RecipeQuery returning true does not mean data arrived: when RecipeQueryGetData leaves the staged words blank, the cause is in the project, not the macro. Set the extended memory location to the SD card, update an outdated EasyBuilder Pro install, and filter on a numeric queue column the recipe database actually contains; then test query, record ID, staging and PLC write as separate layers, one row per PLC request.

On this page
  1. Test four layers in order, and stop at the first silent one
  2. Point the extended memory at the SD card
  3. Update EasyBuilder Pro when the location is already right
  4. Filter on a queue column the recipe really has
  5. Worked example: check the staging map word by word
  6. Release one row per PLC request
  7. The decision for each symptom
  8. Questions asked

A true return from RecipeQuery proves the SQL statement executed — it does not prove that any data reached your destinations. In the reported EasyBuilder Pro 6.10 project on a CMT-FHDX-820, RecipeQueryGetData returned true and still left LW-2000 and every staged word blank, while the same macro wrote to RW without trouble. Three project defects cause that pattern: the extended memory location is not configured, the software build is outdated, or the SQL statement names a queue column the recipe database does not contain. Fix them in that order — point the extended memory at the SD card, update EasyBuilder Pro, add a numeric queue column — then test the query, the record ID, the staging write and the PLC write as four separate layers.

Test four layers in order, and stop at the first silent one #

RecipeQuery and RecipeQueryGetData are documented recipe query functions, so a true return with nothing staged points at their inputs, not at the calls. Every blank staging block in this kind of project comes from one of four layers. Write each intermediate result to a spare local word so the screen tells you which layer went quiet:

  1. Query. RecipeQuery returning true only says the statement ran. Store the match count immediately after the call: zero means the WHERE clause matched nothing, one is the only count safe to transfer, and more than one is an ambiguous queue.
  2. Record ID. With a match confirmed, capture the matched row's record ID before any field extraction. Extraction without it has no row to address.
  3. Staging write. RecipeQueryGetData copies a named column of that record into your arrays. If staging stays empty while a direct GetData of the same recipe field fills the first staging word, the fault is project configuration — the next two sections — not your SQL. A direct read ignores the query and returns the first record, which is exactly why it works as a diagnostic and not as the production path.
  4. PLC write and display. Once staging holds values, a blank screen is a display object aimed at the wrong address, and an unchanged PLC is a SetData destination, element count or data type problem.

Point the extended memory at the SD card #

Extended memory exists only where the project says it does. With the location unset, the recipe database has no storage behind it: ordinary local words and RW behave normally while every extended-memory-backed address stays blank. That split is the signature — the same macro half-works, which points at configuration rather than logic.

The fix: open the project's extended memory setting, select the SD card as the storage location — the choice the working project used — then recompile and download, because the setting travels with the compiled project. Card recognition is a separate step; if the terminal has never accepted the card, see whether an HMI needs setup to recognize a MicroSD extended memory card.

Update EasyBuilder Pro when the location is already right #

In the reported project the extended memory location was set and the destinations were still blank, and the second fault was the tool itself. The install ran EasyBuilder Pro 6.10, old enough that updating the software — same project, same macro, no code change — was what made extended memory appear. Treat that as the second decision rule: with the location set and staging still blank, bring EasyBuilder Pro current on the engineering PC, rebuild and download before debugging the macro any further. No documented version number marks the cutoff, so the update is the test; the reported case needed exactly that and nothing else. Keep the rebuilt project and the terminal's runtime from the same download cycle, because a stale runtime reads on screen the same as a configuration fault.

Filter on a queue column the recipe really has #

The queue is a numeric column added to the recipe database and maintained by your logic: No in the reported project, num in the vendor demo. The statement must name the column that exists — SELECT * FROM Code_Que1 WHERE No = 1 is valid only when the recipe Code_Que1 contains the column No; if the database uses num, filter num. Read the row total before the loop begins with a call like GetData(count, "Local HMI", RECIPE, "Mixer.Count") and select queue positions 1 through that count.

Discipline for the result: a unique queue number should match exactly one row. If the filter matches several, stop the batch instead of letting the macro choose. Treat a zero-row or multirow result as a hard stop — the extracted row becomes setpoints on a running machine, so an ambiguous queue must never write.

Worked example: check the staging map word by word #

This example layout follows the reported project's test registers, which placed CodeTop at LW-2000 and the next 40-character field at LW-2020 — that spacing is the arithmetic: one word holds two characters, so a 40-character field spans 40 / 2 = 20 words.

  • CodeTop occupies LW-2000 through LW-2019, CodeBottom LW-2020 through LW-2039 (2000 + 20 = 2020), Bitting1 LW-2040 through LW-2059, and Bitting2 LW-2060 through LW-2079.
  • The three numeric fields — KeyAlike, RingQty, BinQty — take LW-2080, LW-2081 and LW-2082, one word each.
  • Before each row, clear 96 words from LW-2000: 2000 + 96 - 1 = 2095, so a single write zeroes LW-2000 through LW-2095 and every destination in the map.
  • Zero the arrays themselves as well: the reported macro initialized each 40-element string with 40 zeros and each numeric with 0, because an uninitialized array can carry a previous row's characters that read as fresh data.

The clear is what makes a blank meaningful. With this map, a filled first field proves the query, the record ID and the staging write all ran; a blank one convicts the layers before the PLC write.

Release one row per PLC request #

The trigger is a request-and-acknowledge handshake, not a level. The working demo's loop polls LB-0 and waits while the bit is OFF, re-reading it once per second with DELAY(1000) between reads. The failure mode is a bit that never drops: after row 1 transfers, the next pass through the loop sees ON still standing and sends row 2 immediately.

  • Have the PLC drop the request bit when it finishes a row, so the macro always observes OFF before it looks for ON again.
  • Give the batch one first-row initiator: either the operator Run object requests row 1 or the PLC does when it is ready, never both.
  • Keep three operator values distinct: the row total read before the loop, the current row the statement selected, and the processed count, which increments only when the PLC reports completion — an HMI write is a dispatch, not a completion. Zero the processed count at batch start, and keep the current position somewhere a restarted macro can read back, because a macro-local variable dies with the macro run.

The row-at-a-time exchange follows the same pattern as how to exchange recipe data records between an HMI and a PLC, with the queue column deciding which record each request fetches.

The decision for each symptom #

  • Query true, match count zero. The statement names a column the recipe lacks or a value no row carries; add or rename the numeric queue column and rebuild the filter.
  • Query true, one match, staging blank, RW writes fine. The extended memory location is unset; select the SD card, recompile and download.
  • Location already SD card, staging still blank. The software build is old; update, rebuild and re-download, and only then touch the macro.
  • Direct GetData fills the first staging word, the query path stays blank. The write path is healthy; recheck the column name and the match count in the query half.
  • Direct GetData blank too. The destination address or the display object is wrong; fix the map before blaming recipe access.
  • Row 2 arrives immediately after row 1. The request bit was never seen OFF; require the PLC to drop it between rows.

Questions asked

Where should the current row position live between batches?

In retained local words or in the recipe database itself, with the macro storing the position as each row is dispatched. A variable declared inside the macro disappears when that macro run ends, so a power cycle or runtime restart would otherwise send the queue back to row 1. Reading the stored position at the start of the macro lets a stopped batch resume where it left off.

Should the queue column be text or a number?

Use a number. The working filters compare a decimal value, so the macro appends the queue position as plain digits with no quote characters around it. A text column would need every value wrapped in quote characters inside the SQL string, which invites mismatches between the recipe data and the statement, and a text field sorts positions as characters rather than numbers.

How long should the PLC hold the request bit ON?

Hold it until the macro has written the row, then drop it, and never pulse it shorter than the wait loop's poll interval. The demo re-reads the request once per second, so a pulse shorter than that can be missed entirely and the batch stalls with no error. A held request with a clean drop after each row is self-proving: the macro cannot fetch the next row until it sees the bit OFF.

Can you commission the queue without PLC logic?

Yes. Tie the request bit to a toggle switch on the screen and flip it ON to process the next row, which is how the demo project runs with no controller in the loop. That proves the macro sequence only: a local toggle never forces the bit OFF the way a completed PLC request does, so it validates the query, extraction and staging path, not the production handshake.

Keep reading

  • Explainer

    Weintek recipe database record and word limits explained

    A Weintek recipe database holds up to 10,000 records only while the recipe definition also stays within 1,000 items and a 2,000-word allocation budget; the smallest ceiling sets real capacity. A 25-column recipe of 100-word strings needs 2,500 words and will not compile. Above the record ceiling the documented route is an SQL database, and the built-in CODESYS core changes none of these limits.

    HMI and touchscreens

  • Troubleshooting

    Why EasyBuilder Pro imports no user-defined tags

    When an EasyBuilder Pro CSV import finishes but the user-defined tags stay absent, the file's columns do not match the address tag library format, and in this case the project also carried the Yaskawa MP Series Ethernet extension driver where an MP2600iec Modbus TCP connection needs the Modbus TCP/IP driver. Switch the driver, export a few manually created test tags as a CSV template, move the source values into the matching columns, re-import, and confirm the entries in the address library.

    HMI and touchscreens

  • How-to

    EasyBuilder Pro animation loop needs an address-driven position

    Set the Animation object's position source to controlled by address, then write its position word yourself: a periodic macro or a PLC timer counter increments the point index while the run bit is ON and wraps to zero after the last path point. One pass takes the point count times the macro period, and the switch simply gates the counter.

    HMI and touchscreens

Why an EasyBuilder Pro Scheduler Loses RW Times at Power Cycle