Hi, Hugh -
One thing I noticed is in your XML, you're missing the "default" record. TableSmith datasets always have the default record, defined when you called DSCreate, as the first element.
Outside of that, the syntax looks right for both your calls; I was going to mention that Datasets are 1-based, not 0-based, but in my test starting at 0 appears to work.
I threw together a small table to replicate what you're doing and this worked as I'd expect:
/OverrideRolls 1
%SkillTable%,0
%TempSkill%,0
:Start
1,{DSCreate~SkillTable,SkillName,xxxxx,SkillValue,0}
_{DSAddNR~SkillTable,SkillName,Admin,SkillValue,-1}{DSAddNR~SkillTable,SkillName,Animals,SkillValue,-1}
_|TempSkill=Admin|
_{DSFind~SkillTable,0,SkillName=%TempSkill%}{CR~}
_|TempSkill=Lore|
_{DSFind~SkillTable,0,SkillName=%TempSkill%}{CR~}
_{DSGet~SkillTable,1,SkillName}{CR~}
_%SkillTable%
toggle quoted message
Show quoted text
------- Original Message -------
On Monday, May 9th, 2022 at 2:42 PM, Hugh Foster <Hugh.Foster@...> wrote:
Massive progress! Seems to read the data now. So I do this?
{DSFind~SkillTable,0,SkillName=%TempSkill%}
?
and I get this
?
***ERROR on line 77 of table 'MgTrv2-Package-NPCs' - : 'Object reference not set to an instance of an object.'. ***
?If I do this
?
{DSGet~SkillTable,1,SkillName}
?
I get
***ERROR on line 77 of table 'MgTrv2-Package-NPCs' - Field not found in call to 'DSGet': 'SkillName'. ***
The XML begins?
<data>
? <record>
? ? <SkillName>Admin</SkillName>
? ? <SkillValue>-1</SkillValue>
? </record>
? <record>
? ? <SkillName>Animals</SkillName>
? ? <SkillValue>-1</SkillValue>
? </record>
?
?Which has the field name SkillName correct, but it still falls over. I have to say the error messages don't seem to have any connection to what might be wrong
--
Hugh Foster
hugh@...
http://www.ace-dog.com
Dopeler effect: The tendency of stupid ideas to seem smarter when they come at you rapidly
--
![]()
Monday, May 9, 2022, 7:30:53 PM, you wrote:
Hugh,
?
DSCreate~ creates a dataset in the variable SkillTable, BUT if you haven¡¯t assigned a variable named SkillTable, it has no place to put it.
?
Assign a variable like any other variable and it should be OK.
?
%SkillTable%,<nul>
?
Vance
?
?
?
?
?
Sent from for Windows
?
?
Hi all
?
New here, so please be kind. Many years experience with TS but I cannot for the love of zark get my head round datasets. I know they create a typed array. But every time I try and use them, I get errors. I understand the syntax as far as it goes but really could do with an example to see where it goes and how to wrap stuff round it
?
I have
?
_{DSCreate~SkillTable,SkillName,-,SkillValue,-1}
_{DSRead~SkillTable,TravSkills}
?
and I get?
?
?
***ERROR on line 39 of table 'MgTrv2-Package-NPCs' - Variable 'SkillTable' in table 'MgTrv2-Package-NPCs' not found in call to 'DSRead'. ***
?
There's a relevant file of data which I think is correct. I tried creating %SkillTable%, and got a different error
?
More info is available; any help much appreciated :)
ps tried emailing this in and it seems to have failed, so apologies if I duplicated myself