formresults->GetSingleResult breaks when select field option is deleted

13 views
Skip to first unread message

Anferney Grotestam

unread,
Jan 20, 2025, 8:15:34 AMJan 20
to General WebHare developers discussion
We have a table in WRD in which we keep track of form submissions. Inside this table we also have a field with the resultguid.
We have a dashboard in which we display these form submissions. Below we have a piece of the code that is being executed on the dashboard.
In one of these forms we use a select field. When we delete one of the options of the select field, this code breaks if a result has the same value as the option we deleted.
It breaks specifically when running the GetWittyResultData function from formresults.

OBJECT formobj := OpenWHFSObject(ToInteger(formid, -1));

// getting the results from WRD (sorted by showing the most recent first)
RECORD ARRAY formresultentities := api->GetResultsByForm(formobj->id);

// Get the columns of the form
OBJECT formresults := OpenFormFileResults(formobj);

// Getting the data of the last result using the resultguid
RECORD singleresultforcolumns := formresults->GetSingleResult(formresultentities[0].resultguid);

RECORD ARRAY fields := formresults->GetWittyResultData(singleresultforcolumns).allfields;

Anferney Grotestam

unread,
Jan 20, 2025, 8:16:17 AMJan 20
to General WebHare developers discussion, Anferney Grotestam
stacktrace

Error:
mod::publisher/lib/webtools/formcomponents/select.whlib 901,17: Exception EXCEPTION: No match for rowkey "nc5IMkeGm6m1ZmX19IjAmQ" for field '__formfieldj0k99AlRkqkIEZMAEtYjWw_'.
Stack trace:
mod::publisher/lib/webtools/formcomponents/select.whlib 901,17 (SELECTFIELD#SETNEWVALUE)
mod::publisher/lib/webtools/formcomponents/select.whlib 923,11 (SELECTFIELD#SETVALUE)
mod::publisher/lib/forms/base.whlib 1243,20 (FORMBASE#PREFILLWITHSINGLERESULT)
mod::publisher/lib/internal/forms/results.whlib 699,17 (WHFSFORM#GETWITTYRESULTDATA)
mod::<mymodule>/webdesigns/<mymodule>/pages/inventory/inventory.whlib 114,41 (PAGEINVENTORY#GETPAGEBODY)
mod::publisher/lib/webdesign.whlib 762,52 (WEBDESIGNBASE#__POSTPREPAREPAGE)
mod::publisher/lib/internal/pagerendering.whlib 82,25 (EXECUTEROUTER)
mod::publisher/lib/internal/pagerendering.whlib 120,19 (RUNTHEPAGE)
mod::system/lib/internal/webserver/whfsexecute.whlib 107,3 (DOWHFSEXECUTE)
mod::system/scripts/internal/webserver/whfsexecute.whscr 57,1
You are seeing this page because a HareScript error occured and stracktraces have been enabled globally (eg: wh debug enable etr). Only sysops can toggle this setting.

Op maandag 20 januari 2025 om 14:15:34 UTC+1 schreef Anferney Grotestam:
Reply all
Reply to author
Forward
0 new messages