• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Re: Export format for multi-select Dropdown Element

hominid4

Member
Hi. Has a parameter referenced below been added? I have a Database Join element rendered as checkboxes. And need the CSV export to have no raw data columns and the checkbox selections delimited by commas instead of as "Checkbox One Checkbox Three". Need instead "Checkbox One, Checkbox Three".

http://fabrikar.com/forums/index.php?threads/export-format-for-multi-select-dropdown-element.47978/

And would this parameter change the checkbox selections format in the List View and Details View, was hoping as well to have the selections comma separated in those views instead of as unordered lists.

Thanks!
 
As far as I can tell @bggann didn't submit a PR on our repo for his changes.

So it's a feature I'd have to add.

I don't think the simple case we were discussing (adding a "sep char" option to the join element settings) would be too much work, I'll have a look and if not I'll go ahead and do it.

-- hugh
 
You're correct. I forgot (or didn't figure out how) to do the PR. I've got custom code running, but I'll be doing an update soon and will break that.

- Bob
 
Sure - but it may have been in the template which. I can't remember, but I'll dig it out and send you the info tomorrow.
-bob

- Dang, I forgot. I'll jump on it in the morning. My stupid satellite internet makes it impossible from home.
 
Last edited:
Okay - I modified csvexport.php in the models directory. I've attached the modified file here (changed extension to allow upload).

Changes start at line 172 marked //Special processing for Bruce for additional msos - BGann.
Note - this site is one rev back - on purpose - so I don't know of csvexport.php has changed since this.

This is a hack - I hardcoded the field name because I did not know how to identify the type as a drop down in this code, so I don't know if this is any help.
I replaced the commas with "|" and got rid of the square brackets.
The reason is that excel interpreted the commas as columns, and since the number of "selections" varies per record, the column alignment would be all screwed up depending on how many values were selected.

I do need the change. That is one reason this site is back one rev and I'll be bringing it forward.

I inserted the code between the comments. No other changes.

line 170 : foreach ($a as $key => $val)
{
// special processing for Bruce for additional msos - BGann
if($key == 'daily_log_7_repeat___names_of_additional_msos')
{
$rawkey = $key . '_raw';
$rawvalue = str_replace(',','|',$a[$rawkey]);
$rawvalue = str_replace('"','',$rawvalue);
$rawvalue = str_replace('[','',$rawvalue);
$rawvalue = str_replace(']','',$rawvalue);
$a[$key] = $rawvalue;
}
// End of special processing. BGann
if (substr($key, JString::strlen($key) - 4, JString::strlen($key)) == '_raw')
{
unset($a[$key]);
}
}
}
 

Attachments

  • csvexport.txt
    17.5 KB · Views: 268
Thanks bgann for posting your code. Hugh, doing a friendly bump. I played around with this hack but I'm not exporting raw values and my adjustments, and code placement, aren't working. Thanks!
 
Awesome, thanks a bunch Hugh. It added the comma as needed. My client wanted a space after the comma so I changed $d = $this->renderListData($data, $thisRow, array('sepChar' => ",")); to $d = $this->renderListData($data, $thisRow, array('sepChar' => ", "));. Not sure if a space after the comma is preferred by others, or if no space after the comma is preferred and is a standard output? I'm good either way. Thanks again!
 
Obviously you'll have to re-apply that change whenever you update Fabrik.

At some point I'll probably add a setting for join elements, to specify the sepchar. But that's a lot more work, so I just did it the hard coded way to have a solution now.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top