Bug or intended behaviour?

jfquestiaux

Well-Known Member
When you export to CSV the "full" data (not the "raw" ones), you get, for the "yesno" element "0" or "1" in the CSV file instead of "no" or "yes".
If you replace it with a radiobutton, you get the expected output.

Is there a reason or a purpose for this behaviour?
It would be nice to have the convenience of the "yesno" element (the automatic graphical display of the value) with the CSV output of the radiobutton (some clients like to have "yes" and "no" in their Excel sheets).
 
Hmmm. Looking at renderListData_csv() in the yesno.php, I don't understand what we are trying to do there! Looks like we are kinda trying to return the text if not raw, but if so, it's in a way which would never work.

I'll dig a little deeper ...

-- hugh
 
Can you try editing the yesno.php, and comment out that renderListData_csv() method, just let the default elementlist class do it?

So around line 134 in ./plugins/fabrik_element/yesno/yesno.php, make it look like this:

PHP:
/*
    public function renderListData_csv($data, &$thisRow)
    {
        $raw = $this->getFullName(true, false) . '_raw';
        $rawdata = $thisRow->$raw;
        $data = $rawdata ? $data : FText::_('JNO');
 
        return $data;
    }
*/
-- hugh
 
Hello Hugh,

Well I am afraid it will be more complicated than that. This is what I get then for "yes":
<i class="icon-checkmark icon-ok-sign " ></i>
 
OK. I'm somewhat swamped at the moment, so you'll have to remind me about this on Skype when things calm down a little.

-- hugh
 
I don't see what this should do at all.
I would do
Code:
    public function renderListData_csv($data, &$thisRow)
    {
        $raw = $this->getFullName(true, false) . '_raw';
        $rawdata = $thisRow->$raw;
        $data = (bool)$rawdata ? FText::_('JYES') : FText::_('JNO');
 
        return $data;
    }
BTW: did you really see 1 and 0? on my site it is 1 and No

Edit: seems this is only working if CSV is not including raw data;
if raw data is included the x_raw column is showing yes/no, column x has 1 and nothing:confused:
 
Great. This works fine, as I don't need to export raw data.
And you were right: it was 1 and No, not 1 and 0.

I leave the thread open as there is the raw data issue.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top