Parse Database Query Result Into Custom Module

Hello,

I am trying to parse the data from the SC Database Query Action into my custom module. However, what gets passed into the variables is just the object "{query}" and nothing else, even though I can confirm the query has successfully retrieved data. See below:

hjson file:

{
  type: 'player_streakStatus',
  module : 'player',
  action : 'streakStatus',
  groupTitle: 'Players',
  groupIcon: 'fas fa-lg fa-broom comp-flows',
  title: 'Streak Calculator',
  icon: 'fas fa-lg fa-fire comp-exec',
  properties: [
    {
      group: 'Module Inputs',
      variables: [
        { 
          name: 'actionName', 
          optionName: 'name', 
          title: 'Name', 
          type: 'text', 
          required: true, 
          defaultValue: '',
          baseName: "streakStatus"
        },
        { 
          name: 'logs', 
          optionName: 'logs', 
          title: 'Player Logs', 
          type: 'text', 
          required: true, 
          serverDataBindings: true
        },
        { 
          name: 'output', 
          optionName: 'output', 
          title: 'Output', 
          type: 'boolean', 
          defaultValue: false 
        }
      ]
    }
  ]
}

js file:

exports.streakStatus = async function (options) {
    const logs = options.logs;
    return logs;
}

endpoint output:

{
  "query": [
    {
      "id": "1",
      "created_at": "2025-07-11T22:41:57.237Z",
      "streaker_id": "1",
      "logged_date": "2025-07-12"
    },
    {
      "id": "2",
      "created_at": "2025-07-11T22:42:09.542Z",
      "streaker_id": "1",
      "logged_date": "2025-07-11"
    },
    {
      "id": "4",
      "created_at": "2025-07-11T22:51:11.376Z",
      "streaker_id": "1",
      "logged_date": "2025-07-10"
    },
    {
      "id": "11",
      "created_at": "2025-07-12T13:38:31.031Z",
      "streaker_id": "1",
      "logged_date": "2025-07-09"
    },
    {
      "id": "12",
      "created_at": "2025-07-12T15:35:04.624Z",
      "streaker_id": "1",
      "logged_date": "2025-07-08"
    },
    {
      "id": "13",
      "created_at": "2025-07-12T16:11:32.589Z",
      "streaker_id": "1",
      "logged_date": "2025-07-07"
    }
  ],
  "streakStatus": "{{query}}"
}

The anserr is here, it needs to be parsed to resolve the name to the data

try

const logs = this.parseRequired(options.logs, "*","Logs is required");

Worked like a charm, thank you.

Might be the wrong place to ask this but how come there seems to be so much functionality not even mentioned in the documentation? It's amazing that the forums seem to be alive and well and the information is actually out there.

But finding the information completely relies on the findability of a post that contains the topic in question, unless I have missed something.

I have to agree, i totally understand the Wappler teams need to keep control of everything but the reality is that developing the product is and should be the priority and they have little time to look at docs or videos.
The docs are effectively just a subset of the posts marked with the "docs" catergory.
I rarely look at the docs, i use the forum as often discussions are more helpful than the docs themselves.

2 Likes