Extension talk:Cargo

From two tables to three (new user question)
Not a developer, very new to both Cargo and SQL (used third-party DPL for quite a while previously, all trial and error, limited actual grokking involved).

I am trying to grab parameters from a handful of tables (4 or 5), and format them all through a single template.

So far, I can get the basics to work with 2 tables (something I could not manage with DPL, so far so good):

But when I try to pull parameters from a third table, no dice.

I end up with this error:

Error: Table "DraftExtended" is not included within the join conditions.

And advice? Much appreciated. --Bgrenon (talk) 04:13, 1 April 2016 (UTC)


 * I hope I'll tell you nothing wrong, because I'm very new to Cargo, too. Try this:


 * join on=OptionCreate._pageName=DraftOption._pageName,DraftOption._pageName=DraftExtended._pageName
 * I did a test query in this style and it worked with my tables. --~o)sabine(o~ (talk) 15:30, 1 April 2016 (UTC)


 * This works. Thank you very much!  If I can bother you with a follow up - for the second join, does it matter which left table to join on?  --Bgrenon (talk) 21:09, 1 April 2016 (UTC)
 * The results can change according to the order of the joins.
 * Your tables have a hierarchical structure, don't they? I suppose OptionCreate is the parent table. Are DraftOption and DraftExtended both children or is DraftExtended a child of DraftOption? If both have the same level, they both should join to OptionCreate. If DraftExtended has a lower level it should join on DraftOption.


 * rowspan="2" |OptionCreate
 * DraftOption
 * DraftExtended
 * }
 * or
 * DraftExtended
 * }
 * or
 * or


 * OptionCreate
 * DraftOption
 * DraftExtended
 * }
 * Hopefully this explains it in a clear way. --~o)sabine(o~ (talk) 22:39, 1 April 2016 (UTC)
 * }
 * Hopefully this explains it in a clear way. --~o)sabine(o~ (talk) 22:39, 1 April 2016 (UTC)

Cargo and approvedRevs
Can Cargo coexist with approvedRevs extension? If a new page isn't approved, I think it is stored in the cargo table. --Lmorillas (talk) 18:27, 10 April 2016 (UTC)


 * As far as I know, Cargo does work with Approved Revs, though I haven't tested it in a while. Did it definitely do the wrong thing when you tried it? Yaron Koren (talk) 20:21, 10 April 2016 (UTC)


 * Yes, new pages are stored in Cargo Tables although they haven't been approbed. --Lmorillas (talk) 20:45, 10 April 2016 (UTC)


 * Do you have the "blank if unapproved" setting turned on? Otherwise, I think what you're seeing is the right behavior. Yaron Koren (talk) 22:08, 10 April 2016 (UTC)


 * Yes the "blank if unapproved" is turned on but the row with the pageName is added to the Cargo table. Maybe is a limitation of the ApprovedRevs extension and we should use other extension?. --Lmorillas (talk) 04:45, 11 April 2016 (UTC)


 * Is it possible to know the approbation status of a Page inside a Cargo query? --Lmorillas (talk) 08:13, 11 April 2016 (UTC)


 * I just tried this out, and yes - there does seem to be a problem with "blank if unapproved" and Cargo, unfortunately. I'll have to look into it. No, there's no way to query Approved Revs data in Cargo. Yaron Koren (talk) 15:24, 11 April 2016 (UTC)


 * I think I just fixed the problem with "blank if unapproved", mostly - when it's the latest revision being approved or unapproved, sometimes the change doesn't take effect. Yaron Koren (talk) 16:48, 13 April 2016 (UTC)

Auxilar tables are not cleaned when a page is deleted
When a table has fields of type "list of " the auxiliar tables are not cleaned when a page is deleted and a "recreate data" must be done by hand. --Lmorillas (talk) 08:22, 11 April 2016 (UTC)


 * I can't duplicate this error. Are you using the latest version of Cargo? Yaron Koren (talk) 15:35, 11 April 2016 (UTC)


 * Yes, I think it's the latest version (http://innovacion.educa.aragon.es/wiki/Especial:Versi%C3%B3n) I'll prepare a test site to show you the issue. --Lmorillas (talk) 21:52, 11 April 2016 (UTC)

data not updated when changing cargo_store part in a template
I save a calculation in a Cargo field, but used the wrong formula. After correcting this, every page that uses this template had to be resaved to store the new calculated data. Does Cargo care for those changes itself or do I have to use the maintenance script to push this action by hand? --~o)sabine(o~ (talk) 10:33, 12 April 2016 (UTC)


 * No, and no - besides running the script, you can also go to the "Recreate data" tab/action for that template. Yaron Koren (talk) 13:02, 12 April 2016 (UTC)


 * Well, ok. I prefer using the script and avoid getting doubled lines again. Thanks again for the fast answer. --~o)sabine(o~ (talk) 09:04, 13 April 2016 (UTC)


 * I still think you might have gotten that duplicate data only by calling "Recreate data" more than once... anyway, up to you. Yaron Koren (talk) 13:17, 13 April 2016 (UTC)

Error: 1214 The used table type doesn't support FULLTEXT indexes
When I run php setCargoPageData.php, mysql raises this error.

I'm using mysql 5.5 and I'm affraid before MySQL 5.6 Full-Text Search is supported only with MyISAM Engine.

--Lmorillas (talk) 05:33, 21 April 2016 (UTC)


 * Oh, I didn't know that; sorry. I just checked in a fix, so that tables with a "Searchtext" field will always use MyISAM. Hopefully that works. Yaron Koren (talk) 15:45, 21 April 2016 (UTC)

Row number for queries
This is a re-opening of a topic discussed in march 2016. The question here was getting a row number out of query. There were two reasons for wanting to do this. The first was to add an order number (or other similar) to the display results. The second, my use case, was to change the layout of the template based upon which row. For this case you recommended using Extension:NumerAlpha, using a template layout for the query and add the to the template. I've tried this and would like to report it works correctly for both cases. The second case using works great. Only recommendation is you must use NumerAlpha version 0.7 or later, the earlier version don't work. 64.223.164.86 04:06, 22 April 2016 (UTC)


 * That's very good to know! I should add a "Tips and tricks" section, or some such, to hold this kind of information. Yaron Koren (talk) 18:45, 22 April 2016 (UTC)

Three way join fails with Database error
I'm trying to construct a query joining three tables.

When I save the page with this query, then click on the "View Json" link I get the very unhelpful message:

A database query error has occurred. This may indicate a bug in the software.

I've looked through the logs to find either a query definition or a more detailed error message but can't find either. 70.109.135.112 12:09, 12 May 2016 (UTC)


 * Please add "$wgShowSQLErrors = true;" to your LocalSettings.php file; that should give a more useful error message. Yaron Koren (talk) 13:12, 12 May 2016 (UTC)


 * This is very clear and easy to fix. I would recommend adding this error to the list of "common" ones and ensure it gets exported to the user even without the ShowSQLErrors set. Thank you for the hint. 70.109.135.112 13:44, 12 May 2016 (UTC)

Multiple Date fields--only one has specialized date input boxes
In a template including a Cargo table declaration, I have two fields of type "Date":


 * DOB=Date
 * DOD=Date

I created a form that uses this template. When I use the form to create new records in the table, the input for the first is a simple text box, whereas that for the second is a set of three boxes (popup for month, and text boxes for date and year. Why are they not the same for both fields? (Both show in the same format; e.g., May 16, 2016, when I view the table.


 * This sounds like an error in Semantic Forms' parsing of the template; if you pastebin, or otherwise link to, the template text, I can look into it. But if you ever encounter such an error, you can get around it by hardcoding the Cargo information in the form field, using the "cargo table=" and "cargo field=" parameters. Yaron Koren (talk) 03:26, 17 May 2016 (UTC)

Determining page title from concatenating fields at time of table data entry
I would like to be able to use a form to enter data into a table without first having to specify a name for the associated page that is created. Rather, I would like the name of that page to be determined by concatenating the values of two or more fields, and then populating that page with other data in the record (according to specifications in the associated template). Please suggest how I might do that, or propose an alternate approach.

Example 1: Category, Table, Template, Form: Composer. Fields include Surname and GivenNames and I would like the associated page to be the value of FullName:

Example 2: Concert. Fields include Series, Title, Date. Page title would be Series Title Date.

I want this capability in order to facilitate data entry and to ensure that I have unique names for the pages of a given category without having to enter the details twice.


 * This sounds like a Semantic Forms question, not Cargo; but this might be what you're looking for. Yaron Koren (talk) 17:48, 17 May 2016 (UTC)
 * Exactly the reference I needed; thank you.--Egnatoff (talk) 19:22, 17 May 2016 (UTC)