# Curiosity: why are documented methods throwing AttributeError (is my ignorance showing?)

**URL:** <https://forum.inductiveautomation.com/t/curiosity-why-are-documented-methods-throwing-attributeerror-is-my-ignorance-showing/85081>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [February 1, 2024, 10:07am UTC](https://forum.inductiveautomation.com/t/curiosity-why-are-documented-methods-throwing-attributeerror-is-my-ignorance-showing/85081 "2024-02-01T10:07:47Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![hunterdg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hunterdg/32/67774_2.png) [@hunterdg](https://forum.inductiveautomation.com/u/hunterdg)\
**Post date:** [February 2, 2024, 10:32pm UTC](https://forum.inductiveautomation.com/t/curiosity-why-are-documented-methods-throwing-attributeerror-is-my-ignorance-showing/85081/14 "2024-02-02T22:32:57Z")

</div>

short explanation for everyone asking:

- `list.get()`
  - I wanted an expression structure binding parameter to support named query (including 'json' Return Format option and input parameters)
    - accomplished via runscript() and script transform on expression structure binding
    - enabled parameters to be passed as json string or java.util.hashMap (no dict in expressions)
    - scripting extensions module dataset to json arranges data differently
    - wanted to return a default like named query does

> **binding**
>
> ```auto
> {
> "type": "expr-struct",
> "enabled": false,
> "config": {
> "struct": {
> "consoles": "runScript(\n\t\u0027_system.db.runNamedQuery\u0027,\n\t0,\n\t\u0027Consoles/getConsoles\u0027\n)",
> "userPrefs": "runScript(\n\t\u0027_system.db.runNamedQuery\u0027,\n\t0,\n\t\u0027Metadata/Get User Prefs\u0027, \n\tconcat(\"{\u0027Username\u0027:\", {session.props.auth.user.userName}, \"}\")\n)"
> },
> "waitOnAll": true
> },
> "transforms": [
> {
> "code": "\treturn {\n\t\t\u0027userPrefs\u0027:_system.dataset.pdsToJson(value.userPrefs).get(0,{}),\n\t\t\u0027consoles\u0027:_system.dataset.pdsToJson(value.consoles)\n\t}",
> "type": "script"
> }
> ]
> }
> 
> ```

> **\_system**
>
> ```auto
> '''
> need to sublcass system.* instead of this hack
> '''
> 
> class dataset:
> 
> @staticmethod
> class pdsToJson(list):
> def __init__ (self, pds):
> self.pds = [{colName: value for colName, value in zip(pds.columnNames, row)} for row in pds] if pds else []
> super(dataset.pdsToJson, self). __init__ (self.pds)
> 	
> def get(self, index, default=None):
> if index < len(self.pds): return super(dataset.pdsToJson, self). __getitem__ (index)
> return default
> 
> class db:
> 
> @staticmethod
> def runNamedQuery(path, parameters = None, tx = None, getKey = None):
> import java.util.HashMap
> assert type(path) == str or unicode
> if type(parameters) == java.util.HashMap:
> return system.db.runNamedQuery(path, dict(parameters), tx, getKey)
> elif type(parameters) == str or unicode:
> return system.db.runNamedQuery(path, system.util.jsonDecode(parameters), tx, getKey)
> else: return system.db.runNamedQuery(path, parameters, tx, getKey)
> 
> ```

- `PyJsonObjectAdapter.update()`
  - was chaining script transforms (abandoned that per PTurmel's post on the matter)

basically I wanted one binding instead of multiple

critiques/alternatives welcome!  
go easy on me

---

_[View the full topic](https://forum.inductiveautomation.com/t/curiosity-why-are-documented-methods-throwing-attributeerror-is-my-ignorance-showing/85081)._
