PDA

View Full Version : Database type mismatch on path



alloowishus
November 17th, 2024, 04:01
I added a number field to the record_char_inventoy.xml file

<numberfield name="purchasepercentage">
<anchored to="typefilter" position="right" offset="155,1" height="20" width="40" />
<default>100</default>

</numberfield>

This works for most, but for SOME characters I get "ERROR: windowcontrol: Database type mismatch on path (purchaspercentage) in control (purchasepercentage) in class (charsheet_inventory_contents)"

I set the value on the character sheet as a node, but I notice that for some it does it like this:
<purchasepercentage type="number">100</purchasepercentage>

but for the ones that don't work it does this:


<purchasepercentage>
<holder name="alloowishus" owner="true" />
<purchasepercentage type="number">100</purchasepercentage>
</purchasepercentage>


Any ideas? thanks.

Trenloe
November 17th, 2024, 04:15
This means that the data stored for the PC with the error is the wrong datatype - maybe at some point purchaspercentage was a string or some other different database node type. Have a look in the database at the <charsheet> entries that raise errors to see what type the purchaspercentage node is - or, just delete that node so that it can be recreated with the correct type. If this occurs even for new characters then you'll probably have some code somewhere else that's creating the purchaspercentage with a different type.

DCrumb
November 17th, 2024, 06:35
Also make sure that all of your references are for purchasepercentage and not purchaspercentage (lack of e at the end of purchase).

Trenloe
November 17th, 2024, 14:34
Also make sure that all of your references are for purchasepercentage and not purchaspercentage (lack of e at the end of purchase).
Good spot!

alloowishus
November 17th, 2024, 18:47
This means that the data stored for the PC with the error is the wrong datatype - maybe at some point purchaspercentage was a string or some other different database node type. Have a look in the database at the <charsheet> entries that raise errors to see what type the purchaspercentage node is - or, just delete that node so that it can be recreated with the correct type. If this occurs even for new characters then you'll probably have some code somewhere else that's creating the purchaspercentage with a different type.

The weird thing is that I deleted the node from the db.xml file and took out the part of the code that created the node, but when I reloaded it recreated the node. :(

Trenloe
November 17th, 2024, 20:27
The weird thing is that I deleted the node from the db.xml file and took out the part of the code that created the node, but when I reloaded it recreated the node. :(
If the numberfield you show the XML for in post #1 is created (displayed or initiated via the fastinit setting) then the database node will also be created as this is a "field" control and so it's tied to the database. If you're not displaying that control and the node is being created then there'll be some code somewhere that's creating it.