This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Bool fields viewed always as TRUE

Tags: None
(comma "," separated)
elisey
Registered Member
Posts
2
Karma
0

Bool fields viewed always as TRUE

Sat Jan 25, 2020 10:00 am
Hello, thanks to authors for good tellico!

I'm compile tellico 3.2.3 on Debian 10 (KDE Frameworks 5.54.0, compiled with Qt 5.14.0)

I create own data source - to get xml data from python scrypt.

In .config/tellicorc this source in this lines:
Code: Select all
[Data Source 2]
ArgumentKeys=1
Arguments=-t new
CollectionType=1
Custom Fields=
DeleteOnRemove=false
ExecPath[$e]=$HOME/PycharmProjects/hh/hh.py
FormatType=0
Name=Get NEW
Type=5
UpdateOverwrite=false

In my collection (<collection title="<Skipped>" type="1">)
I have several bool fields (from tellico.xml within my tc-file):
Code: Select all
<field flags="2" name="ponomar" title="Ponomar" category="General" format="4" description="<Skipped>" type="4"/>
<field flags="2" name="tex" title="TEX" category="General" format="4" description="<Skipped>" type="4"/>
<field flags="2" name="printed" title="Printed" category="General" format="4" description="<Skipped>" type="4"/>

When I search new entries via my data source, I get xml-response from my py-script, and tellico fetcher received and recognize it correctly.

Py-script send in xml code this lines within <entry>...</entry> part:
Code: Select all
<printed>true</printed>
<tex>false</tex>
<ponomar>false</ponomar>

(<fields>...</fields> part for this xml code extracted from main tc-file)

And in entry-view in fetcher ALL this fields viewed as TRUE.
And after adding, in main tellico window all they fields viewed as true also. (Into edit entry dialog also)
But in updated tellico.xml within my tc-file this fields have correctly values:
Code: Select all
<ponomar>false</ponomar>
<printed>true</printed>
<tex>false</tex>


UPD: If I edit entry, and check\uncheck this fields - they viewed correctly after this.

Can anybody help in this situation? May be problem into XSL?
robbystephenson
KDE Developer
Posts
384
Karma
1
OS
elisey wrote:Py-script send in xml code this lines within <entry>...</entry> part:
Code: Select all
<printed>true</printed>
<tex>false</tex>
<ponomar>false</ponomar>
(<fields>...</fields> part for this xml code extracted from main tc-file)

And in entry-view in fetcher ALL this fields viewed as TRUE. [/code]

You're right, that's not the best or expected behavior. It's lazy programming on my part. By default, when Tellico writes a data file, if the bool field is false or not set, then the field is not written into the xml at all. And vice-versa, when Tellico reads the xml, if the xml node is present and non-empty at all, it's considered true, even if the text says "false". Until i fix that, the workaround is to just not output the field at all if it's a false value. Hopefully, you can implement that in your code without too much trouble.
elisey
Registered Member
Posts
2
Karma
0
Thank you, Robby, really it's work for me now. Thank you!


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]