Extension talk:Cargo

Order by with format category produces unexpected results
When using the category format and having a list of names, I ordered by the surname (which is set as a separate field). The pages all end up ordered by surname but letter headers are created for the first letter of the page name not based on order by surname. So it ends up with something like this.
 * K
 * Katya Alkaev


 * R
 * Raine Almasy


 * N
 * Nicholas Bevans


 * M
 * Maiko Biladeau-Yukawa


 * A
 * Alexandra Carstairs


 * V
 * Virgil Carstairs


 * A
 * Aisling Cooper

If the category format was able to use the default sort key that would at least help but it doesnt seem like it should be this way either.--Cody3647 (talk) 02:38, 1 January 2016 (UTC)


 * Ah, that's true. I just added a new parameter for the "category" format, called "header field", that takes in the name of an alternate field to get the header letter from. If you try it out, please let me know how it works for you. Yaron Koren (talk) 02:42, 4 January 2016 (UTC)


 * Still having the problem, http://absitomen.com/lexicon/Portal:Characters --Cody3647 (talk) 01:27, 9 January 2016 (UTC)


 * It looks like it's doing the right thing - you just need to also order by that field. Yaron Koren (talk) 05:09, 9 January 2016 (UTC)


 * Ah, yep that fixed it. Thanks --Cody3647 (talk) 06:21, 9 January 2016 (UTC)

Gallery Format Options
The gallery format with SMW/SRF had the ability to set the image caption based on a property. Is there a way to do similar with a cargo field used for the caption? And also to set the heights and widths, and turn off the file names and file size.--Cody3647 (talk) 02:23, 2 January 2016 (UTC)
 * Forgot that I asked about this here, but I uploaded a patch with the gerrit patch uploader to add the gallery parameters to the query format. --Cody3647 (talk) 19:01, 15 January 2016 (UTC)


 * Yes, I saw - sorry; it's on my to-do list to look into this. Yaron Koren (talk) 19:24, 15 January 2016 (UTC)


 * No problem, just saw this when writing up another question.--Cody3647 (talk) 19:29, 15 January 2016 (UTC)

$wgCargoAllowedSQLFunctions in LocalSettings Not Working
I have RAND, GROUP_CONCAT,IN added to $wgCargoAllowedSQLFunctions in LocalSettings and I'm getting the error "the SQL function "RAND" is not allowed." I just pulled the latest version of Cargo from git and Im running MW 1.25.5. --Cody3647 (talk) 01:14, 9 January 2016 (UTC)


 * What does the #cargo_query call look like? Yaron Koren (talk) 05:09, 9 January 2016 (UTC)


 * , I was able to fix it by adding the functions straight into the array in Cargo.hooks.php.--Cody3647 (talk) 06:10, 9 January 2016 (UTC)


 * Aha - that was due to a bug in your MediaWiki version's handling of extension.json. I just added what I think is a workaround to the Cargo code. Yaron Koren (talk) 16:58, 10 January 2016 (UTC)


 * Just started the process of testing the upgrade to mediawiki 1.26 and $wgCargoAllowedSQLFunctions is not working again on my test wiki. --Cody3647 (talk) 17:33, 29 January 2016 (UTC)


 * That's not good. What exact MW version are you using? Yaron Koren (talk) 19:18, 29 January 2016 (UTC)


 * It was 1.26.2 but I was having a lot of weird issues with the install/upgrade of the test wiki so I have removed it all until I have time to deal with it. --Cody3647 (talk) 06:07, 2 February 2016 (UTC)


 * Yes, okay - I see the same problem. I just set it so that extension.json is only used for MW 1.27 and higher - hopefully the problem has been fixed in 1.27. Yaron Koren (talk) 19:26, 3 February 2016 (UTC)

A big table — a big problem
I can not save the full amount of data. Action "recreatedata" and cargoRecreateData.php don't help. The problem is clearly in time-outs, as the number of rows after each regeneration turns different. Pages are big, some contain about a thousand queries. The table is simple, it is less than ten fields. My wiki includes about 800 pages with the table queries to create 17 thousand rows. It created about 13 thousand. What should I do? --StasR (talk) 09:50, 13 January 2016 (UTC)


 * By "queries", I assume you mean "template calls". I can see the problem: when it does its batching, the web interface assumes that each page contains an average of one or two calls to #cargo_store - not hundreds or thousands. The batching definitely needs to take that into account, if that's possible. In the meantime, have you tried calling the command-line script? That seems like it should still work. Yaron Koren (talk) 13:45, 13 January 2016 (UTC)


 * Yes, I mean "template calls". I wrote: Action "recreatedata" and cargoRecreateData.php don't help; script created ~13,000 rows vs 10-11K on "recreatedata".  --StasR (talk) 14:32, 13 January 2016 (UTC)


 * Oh, right. Did the script crash? Have you tried running it more than once? Yaron Koren (talk) 15:23, 13 January 2016 (UTC)


 * When the interactive performance, all the job are seen in the job queu? I made a long pause and run the script again. I did it twice, and the results are identical :-) The number of entries is still different from the expected. Do you allow one page to create two identical rows in the table? --StasR (talk) 15:39, 13 January 2016 (UTC)


 * I didn't understand the first question, but the script doesn't use jobs - only the web interface does. The fact that the results are identical is actually a good sign - it means that the problem is not with the size of the data, but with something else. Yes, you can have identical rows from one page (they won't be fully identical, since they'll have different _rowID values). Is there any way you can run some analytical queries on the data set that was generated, using "group by" or something, to try to figure out if there's a pattern to the data that's missing? Did certain pages not get stored at all, or maybe the issue is rows with certain values? Yaron Koren (talk) 16:11, 13 January 2016 (UTC)


 * First question was: can be invisible remnants of the interactive 'recreatedata'? (The job queu was empty, but I ran the script immediately after 'recreatedata'.) I'm looking for errors, and is found only one, with two identical calls on the same page. --StasR (talk) 16:37, 13 January 2016 (UTC)


 * Identical calls are wiki Scribunto problem, not Cargo. Direct template calls work properly. --StasR (talk) 16:50, 13 January 2016 (UTC)


 * Oh, I see. Yes, it's certainly possible that the jobs created by the web interface could be interfering with the script. I would just delete everything from the job queue, if you want to "cancel" the recreatedata action. Yaron Koren (talk) 17:36, 13 January 2016 (UTC)


 * It seems to be on the theme: (MediaWiki_1.24/wmf8) - Add PPFrame::isVolatile and PPFrame::setVolatile  --StasR (talk) 21:04, 13 January 2016 (UTC)

Sorry, I don't understand the connection to those MW issues. Yaron Koren (talk) 15:25, 14 January 2016 (UTC)

Combination Outline and Template Formats
So I'm trying to get the function of the outline format to display a series of events and articles with more information and with formatting that is beyond just a simple list. I could use just the template format but that would end up listing the dates, since events and articles often have the same date, over and over again, hence wanting to use the outline. I tried using concat but that quickly got weird and confusing.

I also tried creating a new format but my php skill level especially with classes has made it difficult without repeating a lot of code. Would it be possible to create a new format that combines the two formats? Or other suggestions for getting the same result?--Cody3647 (talk) 19:28, 15 January 2016 (UTC)


 * Would adding a 'template=' parameter to the 'outline' format solve this problem? Yaron Koren (talk) 21:51, 15 January 2016 (UTC)


 * Probably yes. To replace the list/parenthetical list output of the remaining fields. --Cody3647 (talk) 21:58, 15 January 2016 (UTC)


 * I did figure out a way to do it with one level using the template format and the variables extension. --Cody3647 (talk) 22:07, 15 January 2016 (UTC)


 * Alright - it does seem like adding a "template" parameter would allow for an easier solution. Yaron Koren (talk) 04:37, 17 January 2016 (UTC)

Line breaks in wikitext format
I have a field that is setup as Wikitext. I have a block of text that has a line break in it (empty line line break not a hardcoded line break) and when getting the field via a query the line break is gone. I double checked in the database itself and the line break is still in the saved version. --Cody3647 (talk) 03:36, 16 January 2016 (UTC)


 * Is it a single line break, or a double line break? Because single line breaks are ignored by the MediaWiki parser. Yaron Koren (talk) 04:38, 17 January 2016 (UTC)


 * Double line break, but I think I figured it out. I had it in a div, but moved it into a blockquote and now the line break shows up.  --Cody3647 (talk) 17:23, 17 January 2016 (UTC)

Dashes in field value in WHERE clause
gives Error in "where" parameter: the string "--" cannot be used within #cargo_query. Why? --StasR (talk) 15:08, 17 January 2016 (UTC)


 * It's because "--" is used for comments, and comments can be used for SQL injection. Though I think "--" within quotes doesn't pose a threat, so that should be fixed. On the other hand - why do you have that format for the value? I didn't expect many values to contain this string. Yaron Koren (talk) 03:43, 18 January 2016 (UTC)

Random Question Marks appended to File Name
I have a SF field that takes a file name, it is saved to a cargo field that is defined as for a File.

13 of the 780 pages that have saved a file name in that field, have had random ? added to the end of the file name in the database. Some have had multiple ? (up to three in a row at the moment) added. Some are png, jpg, jpeg. The question marks are not showing up in the field/or wikitext (the image does display in the image preview).--Cody3647 (talk) 17:33, 17 January 2016 (UTC)


 * Very strange. Is there any pattern to when they show up? Are some of the characters in the file names non-ASCII? Yaron Koren (talk) 03:46, 18 January 2016 (UTC)


 * None that I can tell. These are the names of the files as they show up in the database:   The other 750+ are just fine and are in the same format, entered in the same way.  I tried editing the question marks out in the database, but its back on the next save.--Cody3647 (talk) 04:21, 18 January 2016 (UTC)


 * Not sure how but on closer inspection of the source when on the edit source page, somehow the html entity for left to right marks were added, sometimes multiple times in the cases of the multiple question marks.--Cody3647 (talk) 04:30, 18 January 2016 (UTC)


 * Oh, interesting. Could it be these left-to-right marks also exist in the page source, but are not visible in the browser? Yaron Koren (talk) 04:59, 18 January 2016 (UTC)


 * They were, Ive removed them all now, no idea how they got there. --Cody3647 (talk) 13:14, 20 January 2016 (UTC)

Time Format
This is partly SF and partly Cargo. But basically I need to store time independent of the date. I know i can split them out in the query, but SF when doing datetime automatically makes it midnight for the date entered instead of leaving it blank on saving with just the date and no time. I thought about making it with text fields but I want to be able to sort on time, and Im guessing that a mysql text field is sorted different from a time field and there's no way to set the mysql field as time that I can find.--Cody3647 (talk) 20:06, 23 January 2016 (UTC)


 * I didn't think a "Time" type would be that useful - maybe that was a mistake. But I think you could do a hack to enable sorting, even if you implement it as text fields - have another template/Cargo field that holds the number of minutes (or seconds) in the time, by doing a mathematical calculation with the values of the text fields, probably using #expr. Then sort on that field. Yaron Koren (talk) 03:33, 24 January 2016 (UTC)

Storing Extension:External_Data content with Cargo
I am trying to move data from a CSV into Cargo via Extension:External_Data but I'm only able to grab the first row by using the #external_value function within #cargo_store. I tried putting #cargo_store inside #for_external_table so it would iterate and store all rows but it seems to evaluate #cargo_store first and inserts a single row with my param text (instead of the actual value as assigned by #for_external_table). In a nutshell: Is there a way to store full CSV files into Cargo? --Patrick


 * I found the solution, it is documented on the External Data page. Make sure to copy the examples, I believe there is a bug in #display_external_table. The documentation says to use a "data" parameter but the example uses a "date" parameter and "date" is the one that worked for me. --Patrick


 * Oops - that was a typo in the example page; thanks for catching it. Actually, I think it works either way - if you don't specify a "data" parameter, #display_external_table just displays (and if you use Cargo, also stores) every field from the CSV. So having a "date" parameter instead is like having no parameter at all. But I just changed the example to use "data=", and it seems like it still works. It didn't work for you? In any case, either way is fine. Yaron Koren (talk) 21:48, 27 January 2016 (UTC)


 * Haha your error caused me to find my error. I was calling #display_external_table with the external CSV values instead of the internal variable names. Since it defaults to everything the "date" parameter was doing nothing and when I tried assigning "data" it was getting invalid variable names with spaces in it, etc. causing it not to work. The definition for the date parameter led me to believe I should populate it just like I did for #get_web_data
 * data - the data mappings between external variable and local template parameter; much like the data parameters for the other functions
 * It's actually a mapping of internal variables in this template to variables in the template being called. Also I didn't realize the data parameter was optional, that is awesome because I always plan on using all columns so that is a lot less leg work.


 * Okay, great. I don't understand the confusion, though - there's only one template, no? Yaron Koren (talk) 01:32, 28 January 2016 (UTC)


 * I made a wrapper template so that I can define the columns of the file in one place. The template accepts the URL of the file so different pages can easily show different files that are in the same format. --Patrick

Missing Gallery Module for Packed-hover gallery
After updating mediawiki to 1.26.2, the packed-hover gallery option of the gallery format was displaying as a list instead of a gallery. After looking around, it seemed that the javascript for galleries was not loading. Adding  to the display method of CargoGalleryFormat got things looking correct again. --Cody3647 (talk) 01:19, 10 February 2016 (UTC)


 * Strangely, I'm not seeing this problem - I'm running MW 1.26.2, and "packed-hover" shows up for me (more or less). Are you using the latest version of Cargo, 0.11? By the way, I say "more or less" because the display of "packed-hover" shows up for me the same as that of "packed-overlay" - nothing happens when I hover over the image. But the same thing happens when I view the examples at Help:Images - "packed-hover" does nothing on hover. And I've tried it on multiple browsers. Are you seeing the same thing? Yaron Koren (talk) 02:55, 12 February 2016 (UTC)


 * Yep, have Cargo 0.11 installed.  And packed-hover works for me.  The overlay only shows when hovering.  This is what it looks like with the line I added removed http://prnt.sc/a2r8w8 --Cody3647 (talk) 15:56, 13 February 2016 (UTC)

Concepts
Hi I wondered if Cargo has an equivalent to Concepts in SMW?

Many thanks

Duncan


 * No, unfortunately - out of curiosity, what would you use them for? Yaron Koren (talk) 00:38, 14 February 2016 (UTC)
 * Hi Yaron. I wanted to have reusable query snipets.  Eg I could define queries that could be used within another query.  Having said that, I guess I could probably do that with templates?
 * Many thanks - Duncan, 14 Feb 2016


 * I suppose you could, with "mini-templates" for each parameter, but it might be easier to just re-do the query every time. Yaron Koren (talk) 12:18, 14 February 2016 (UTC)

SF and Cargo produce "Error: operator for the virtual field 'file_extension' must be 'HOLDS', 'HOLDS NOT', 'HOLDS LIKE' or 'HOLDS NOT LIKE'."
Hello folks

I have a form with the following field defined: of which the data is stored in table instance and field file_extension. The field itself is defined as file_extension=List  of Text

When I try to access the form, I get the error message Error: operator for the virtual field 'file_extension' must be 'HOLDS', 'HOLDS NOT', 'HOLDS LIKE' or 'HOLDS NOT LIKE'.

What I was expecting was an input field where already given values for table instance field file_extension would appear in the suggestion list.

Can somebody please tell me what I did wrong?

Tobias (talk) 12:51, 23 February 2016 (UTC)
 * OK, just upgraded to SF 3.4.3-alpha. Works as intended. :) Sry about all the fuss :/
 * Tobias (talk) 13:52, 23 February 2016 (UTC)

Big page
There is a page with a large number of requests (write data in the two tables, approximately 1000 lines each). When saving, no error is shown. The page is displayed completely. But the data in the tables are recorded only about 700-900 records each (unstable). It's like a timeout, but why are there no warnings? --StasR (talk) 19:41, 28 February 2016 (UTC)


 * The debug log contains nothing interesting, just recorded few lines. --StasR (talk) 17:34, 29 February 2016 (UTC)


 * I added an extra wfDebugLog calls in CargoStore.php. It turns out that for an arbitrary number of the last rows run is not called. The template that contains #cargo_store, is performed for all rows. --StasR (talk) 21:19, 29 February 2016 (UTC)


 * I had a similar problem awhile back with lots of fields and Yaron pointed me here: http://php.net/manual/en/info.configuration.php#ini.max-input-vars --Kc5vcx (talk) 03:14, 1 March 2016 (UTC)


 * Thanks. But I have not lost the last fields. Lost the last rows. Since the number of lost rows is variable, and the page text are always presented completely, I assume that the problem is in asynchronous write table rows. --StasR (talk) 16:48, 1 March 2016 (UTC)


 * I don't know why there's no warning message, but clearly there appears to be some sort of timeout. 2,000 calls to #cargo_store in one page (if I understand the numbers correctly) is a lot! Why so many, if I may ask? Why not split up the data across multiple pages? Yaron Koren (talk) 19:55, 1 March 2016 (UTC)


 * It is clear that 2000 is very much. This wiki is similar to wikisource, and the page is a document of about 1000 people. And, most importantly, how can I find out that so many turned into too many, if there is no warning? --StasR (talk) 20:47, 1 March 2016 (UTC)

Issue with Boolean Fields and Semantic Forms
Boolean Fields are not updated with semantic forms. Semantic Forms insert a Sí/no (yes/no in spanish) word in the template [1] but Cargo inserts Sí (yes) as false (0) in the table [2].

[1] http://innovacion.educa.aragon.es/wiki/Certamen_de_Lectura_en_Voz_Alta

[2] http://innovacion.educa.aragon.es/wiki/Especial:CargoTables/RecursosDBN

--Lmorillas (talk) 15:54, 16 March 2016 (UTC)