Extension talk:Cargo

Every Date after 27-12 (include) in every year will be stored as the next year
Hi, Im using cargo 2.0.1.

I saw a problem that i can reproduce with open new table (2 fields, one of them is Date).

I store this value in the Date field=28-12-1957 and when i query\see this table the saved date is: 28-12-1958.

Tried also:
 * year > 2000
 * Insert the date as: 1957-28-12

TY — Preceding unsigned comment added by Koshob (User talk:Koshob • Special:Contributions/Koshob) 22:48, 2 August 2020‎ (UTC)


 * This might have been fixed already. Could you try using the latest version of Cargo? Yaron Koren (talk) 00:16, 3 August 2020 (UTC)

Koshob (talk) 21:13, 3 August 2020 (UTC) Indeed, ty!

Conditional formatting tables
I Have a table with different color hexcodes in table cells. Is it possible to make the backgroundcolor of a tablecell so to match the code for each cell? Something like: style=background: #c6bdab | DGWKJacobs (talk) 10:42, 10 August 2020 (UTC)


 * Are you asking about the Cargo "template" format? Yaron Koren (talk) 13:53, 10 August 2020 (UTC)


 * Its about a cargo query with table as display format. I am trying:


 * Unfortunately, I don't think there is any way to set the formatting of cells in the the "table" format. You might have to instead manually (more or less) create the table, using the "list" or "template" formats. Yaron Koren (talk) 20:17, 13 August 2020 (UTC)


 * I nested the cargoquery with template as displayresult inside the wikitable syntax: DGWKJacobs (talk) 02:00, 28 August 2020 (UTC)


 * The template Colortable defines the body of the table:


 * || ||  || style='background: #' | # || style='background: #' | # || style='background: #' | # || style='background: #' | # || style='background: #' | #

Error: table “Level” not found
See also phab on miraheze.

The template located at Template:关卡信息 defined a Cargo table "Level". However, when visiting Special:CargoTables/Level, it reads: Error: table Level not found. And Special:CargoTables shows nothing. If I re-create the table, it doesn't help.

I also created some sandbox tables like Template:Sandbox and Template:沙盒, and the same thing happens.

The error message provides no details. It's unlikely to set $wgShowExceptionDetails according to Miraheze stewards and actually the detail is the same as a table that really does not exist.

--SolidBlock (talk) 10:55, 17 August 2020 (UTC)


 * Yes, clearly the table was not created - your Special:CargoTables page shows no tables. Somehow the "create table" command failed - maybe because the template name contains non-ASCII characters, I don't know. Did you try creating the table from the web interface, or the command line? Whichever one you tried, I would try the other one. Yaron Koren (talk) 15:29, 17 August 2020 (UTC)
 * I created the table via the interface label near the "view/edit/history". Maybe due to non-ascii characters, but Template:Sandbox is also wrong. And the parser function #cargo_declare shows the table is defined (unless the table is really not defined). ——SolidBlock (talk) 15:53, 17 August 2020 (UTC)


 * Oh, I didn't notice that you mentioned the "Sandbox" template as well. Yes, that one looks totally non-ASCII - and all the calls in it look fine. And you probably don't have command-line access, unfortunately. Here is what you should do: go again to one of those templates, "inspect" the page by right-clicking and then go the "Network" tab, and follow the process again to create the table. The last URL in the "Network" tab is the API page that actually does the table creation; if you go to that URL, you might be able to see a more helpful error message. Yaron Koren (talk) 16:59, 17 August 2020 (UTC)


 * I did what you said to, and got the following messages:
 * https://rs.miraheze.org/w/api.php?action=cargorecreatedata&table=Sandbox&template=Sandbox&offset=0


 * https://rs.miraheze.org/w/api.php?action=cargorecreatetables&template=Sandbox


 * --SolidBlock (talk) 00:50, 18 August 2020 (UTC)


 * Alright - here is indeed a case where being able to see the exception details would be helpful. My only guess right now is that the database tables cargo_tables and cargo_pages were never created for this wiki (update.php needs to be called to create them). Is that possible? Yaron Koren (talk) 01:07, 18 August 2020 (UTC)
 * I don't think so...I don't know how to call update.php. SolidBlock (talk) 01:50, 18 August 2020 (UTC)
 * I meant, is it possible that that's the issue. Yaron Koren (talk) 03:53, 18 August 2020 (UTC)
 * I see "Error: 1054 Unknown column 'field_helper_tables' in 'field list' (db11.miraheze.org)" in the logs. RhinosF1 (talk) 08:48, 18 August 2020 (UTC)
 * Aha! That's helpful. The column field_helper_tables was added in 2017. So clearly either this database, or the code you are using to install Cargo on a new wiki, are from before then. You just need to update the DB, or the code, or both, and then hopefully everything will work. Yaron Koren (talk) 14:10, 18 August 2020 (UTC)
 * I will inform miraheze stewards. They may be able to help do that. --SolidBlock (talk) 14:28, 18 August 2020 (UTC)
 * It's fiexd now. Thanks for your help. --SolidBlock (talk) 03:34, 23 August 2020 (UTC)

timeline error - Caught exception: SyntaxError: Unexpected token '<'
Hi, I´m new to Cargo and running a private wiki on Windows 7 64-bit with Xampp 7.4.7. I'm getting the above error when trying to see timeline displayed on Drilldown and also when I try to use it as a display format of #cargo_query. After some research I have found this 2018 post about what seems to be a similar problem: 1.timeline causing error

However, the sugested fix didn´t work for me (installing MagicNoCache extension and adding "__NOCACHE__", on a line by itself, to any page that calls the "timeline" format.). The same error message remains...


 * Caught exception: SyntaxError: Unexpected token '<'

Even if the fix worked, I wouldn´t be able to use it on Special Page drilldown, since, as far as I can see, it's not possible to edit this page to add the magic word. I wonder if it has some relation to previously installed SMW or the Modern Timeline or Semantic Bundle extensions on my wiki. Before I discovered Cargo...

My installed software are recent versions, but my system Windows OS is perhaps a bit outdated...


 * MediaWiki	1.34.1
 * PHP	7.4.7 (apache2handler)
 * MariaDB	10.4.13-MariaDB
 * Page Forms	4.9.5
 * Cargo	2.6
 * Page Schemas	0.5.1

PS: When I try to use the Cargo Query Special Page, it displays the query correctly, except for the error message

ErrorException from line 106 of C:\xampp\htdocs\mediawiki\extensions\Cargo\includes\CargoQueryDisplayer.php: PHP Notice: Trying to access array offset on value of type null

This line of code reads

$tableName = $this->mFieldTables[$fieldName];

I suspect it is somehow connected to the problem...

Any help would be much appreciated!

csv export
Hello, I have a one cargo table. I have a multiple instances template and a main template.

Is it possible to get my csv export to contain all my fields to populate one row? My multiple instance data populates a separate row and my main template data populate another row. Note, I am using a cargo_query:

Program Name is from the main template. Thank you for your wonderful tool! Regards, Margaret


 * I don't understand - you have two templates but only one Cargo table? Yaron Koren (talk) 22:31, 31 August 2020 (UTC)


 * Yes, One Cargo table and two templates. The main template and a multiple instance template that attaches to the table.


 * If I understand it correctly, these two templates each have a different set of fields. If that's the case, they should each have their own Cargo table - defining them together provides no benefit. If you want to then display them together, use "join on". Yaron Koren (talk) 13:53, 2 September 2020 (UTC)


 * If I can add a multiple instance template in the main template, that would be preferred. Maybe I missed something when it comes to the multiple instances (when you can add the same field multiple times on one page.) Thank you for your info. Margaret

What is a cargo admin?
Hello guys! I am confused about cargoadministrators. What do they do? --Jakek (Talk | Contributions | CentralAuth) 18:16, 29 September 2020 (UTC)


 * There's no such thing as a "Cargo administrator", at least by default. Cargo defines two permissions - "recreatecargodata" and "deletecargodata" - which, by default, are only available to admins/sysops. You could create a user group that has those two permissions, but there's no need to do it. Yaron Koren (talk) 18:22, 29 September 2020 (UTC)

Question about query documentation
The query documentation page explains the #cargo_query parameters entirely in reference to SQL SELECT queries, as opposed to describing their functions independently. Is there anywhere where the parameters are explained in terms of what they actually mean for those who know nothing of SQL? Sunmarsh (talk) 15:15, 8 October 2020 (UTC)


 * That's very true, I never thoughts about that... I need to improve the documentation. Yaron Koren (talk) 14:22, 13 October 2020 (UTC)

Dynamic Tables and Detail/Hidden Fields: Is there a known live example?
I cannot figure out why my attempts at using the Hidden and Detail Fields features of the Dynamic Table format are not working and was hoping to find a working example somewhere. The two examples given in the Dynamic Table subsection do not utilize these options. I tried using the query editor and while it does generate wikitext, it does not work (either in the "preview" of the editor or in a page itself). A small bit I noticed is that while the input fields in the query editor generally give options/predictive text when selecting tables/fields, it does not in these Detail and Hidden fields....maybe this functionality doesn't function yet? Thanks in advance for any help that can be provided. --206.55.182.254 03:52, 11 October 2020 (UTC)


 * Here is a live example I just generated, using Special:CargoQuery. Note that any fields listed in "details fields" or "hidden fields" have to also be included in "fields" - maybe that explains the problem you were seeing. And it would be great if those two inputs had autocompletion in Special:CargoQuery, but that is not implemented yet, unfortunately. Yaron Koren (talk) 14:27, 13 October 2020 (UTC)


 * Ahh okay, I didn't have it in the selected fields as you suggested. Thank you!  Now I'm going to experiment with only returning fields that have data.  --206.55.182.254 15:17, 13 October 2020 (UTC)

Back again (this time as a registered user!) with another question on details fields. Is it possible to only show fields that are marked as "detail fields" if there is a result/value in the field? I understand that for a normal table it wouldn't be possible because if any record has a result, there is no way to "hide the column/field". But if the fields that are marked as "detail" does that they mean they are basically their own mini table, and thus able to have each field hidden if there is no value in it? If there are 5 total detail fields for each record, and a particular record only has values in 3 of those fields, could I hide the other two? If not possible with the data/table itself, I'll see if i can do it with CSS. Thanks again for your help.--GrapheneBob (talk) 17:25, 14 October 2020 (UTC)


 * It's not currently possible. "dynamic table" uses the DataTables JavaScript library, so if it's possible there, then it could probably be added to this result format. Yaron Koren (talk) 21:51, 14 October 2020 (UTC)


 * Okay thank you for confirming. In the meantime, I think I'll be able to do this with CSS by targeting empty td or p tags and reducing their width/height to 0.  Thanks again!--GrapheneBob (talk) 00:30, 15 October 2020 (UTC)

Exception: Parser::parse recursively? Lock is held by...
Hi, Im keep getting this exception: https://pastebin.com/McL4SzFb while running a query, Be glad for help.

When running the original Query with bigger limit im not getting this exception. This one is raised only when running the query with a limit (lets say 15) and then pressing the "More..." link to see a special window with more results.

I can supply the query, But that seems to be related to "Special:CargoQuery" Page. TYVM for help Koshob (talk) 22:22, 11 October 2020 (UTC)


 * Yes, what is the query? And what version of MediaWiki are you running? Yaron Koren (talk) 14:28, 13 October 2020 (UTC)

Query Mapping Info
MW 1.35 Maps 7.20.1 Page Forms 2.7

How do I create a page that displays the coordinates (pin) on a map of entries I made from Page Forms? This does not work: and says Error: Table New Home Builders not found. Cargo is installed, Maps installed, Page Forms installed and at least Page Forms and Maps work as it creates the pages I enter. Thanks! -- Foreclosurepedia (talk) 20:38, 15 October 2020 (UTC)

I figured out the other issues (spaces must use _ and field was address); however, I do not know how to display those coords on a Map.

Page calling data for map: https://digitalmatrixgroup.com/index.php/Investor_Assets format=googlemaps works but kicks the developer stuff, I want to use Open Street Maps. Thanks! -- Foreclosurepedia (talk) 21:02, 15 October 2020 (UTC)

Solved. openlayers is openstreetmaps for want of better words. Leaving up for other new folks like me whom have no clue. -- Foreclosurepedia (talk) 21:25, 15 October 2020 (UTC)

Some pages do not get stored on their table?
Hello, I'm having an issue that I'm not entirely certain how or why it is occurring. For some reason, not all pages using the template that defines and stores data in one of our cargo tables appear in the table defined by it. Editing the page to force it to update has no effect. If it helps, this is the table and this is one of the pages which is consistently affected. It isn't in the table at all, even though it uses the template that defines the table. What could be causing this? Disgustedorite (talk) 04:27, 31 October 2020 (UTC)

UPDATE: I figured it out. Changed columns "diet" and "descendants" to Wikitext instead of Wikitext String because they can sometimes be really really long. Disgustedorite (talk) 20:11, 1 November 2020 (UTC)


 * That's very strange. If you have access to the command line, I would recommend calling cargoRecreateData.php from the command line, and seeing if that or any other pages lead to any error messages. Yaron Koren (talk) 02:43, 2 November 2020 (UTC)

Return value of Parser::getTitle must be an instance of Title, null returned
An error occurred after upgrading to 1.35.0（Cargo version 2.7）.


 * Sorry about that - it looks like the handling of Parser::getTitle changed in MW 1.35. I just checked in to Cargo what I think is a fix for this. Yaron Koren (talk) 15:15, 2 November 2020 (UTC)


 * Thanks, the problem is solved after the update.

ANDed HOLDS statements do not produce expected result
On our Gamepedia wiki, this Cargo query fails to return the expected results. The same query but with  does work as expected.

There is a workaround using  with LIKE as documented on the Gamepedia Help wiki but I wanted raise the issue here in case it wasn't already.

Gamepedia is still on version 2.2 for the time being. Phantom Caleb (talk) 16:02, 8 November 2020 (UTC)


 * I logged T267498. PhantomCaleb (talk) 20:09, 8 November 2020 (UTC)

Recreate does not add data to Cargo DB
The only way to get data in my Cargo DB is to edit and resave pages containing expressions like

Using recreate in http://localhost/mediawiki/index.php/Special:CargoTables or corresponding php code have no result.

Cis:/var/www/html/mediawiki/extensions/Cargo/maintenance$ php cargoRecreateData.php Recreating data for Cargo table Topic in 5 seconds... hit [Ctrl]-C to escape. Deleting and recreating table... Handling template that adds to this table: Topic Saving data for pages 1 to 0 that call this template...

Product	Version MediaWiki	1.35.0 PHP	       7.4.12 (apache2handler) MySQL	       5.7.32-0ubuntu0.18.04.1 ICU	       65.1 Semantic MediaWiki	3.2.0 Cargo	               2.7


 * Is that #cargo_store call in a template, or just in a standalone page? The "recreate" calls will only work if it's in a template that is in turn called by other pages. Yaron Koren (talk) 23:58, 8 November 2020 (UTC)

Understood. But then I have another (probably stupid) question: How do I transfer the values for the properties (Year, etc) in my standalone page to my Template «{ {Boek} }» ? «[ [Year::1607| ]][ [Published in::Alkmaar| ]] [ [Language::Dutch| ] ]» into «{ {Boek} }»


 * You need to make your "book" pages (and maybe others as well) template-based - meaning that all data contained in those pages, like "1607", should be contained only within template calls. Yaron Koren (talk) 14:51, 9 November 2020 (UTC)

DATEDIFF with interval parameter seems not to be possible (Incorrect parameter count in the call to native function 'DATEDIFF')
Hello everybody,

I am trying to use the DATEDIFF date function in a cargo query to get only datasets in a certain range of time. In my case, results should only be displayed, if the date of the corresponding cargo field is within the last 6 months from now.

I tried to add an interval parameter like "month" as it is possible in SQL.

It should look like this

DATEDIFF(month,date,NOW) >= -6

But if I run the query with this where-condition, I only get the error message "Incorrect parameter count in the call to native function 'DATEDIFF'".

Does anybody know a workaround to get this running?

Kind regards, Axel --Shuitavsshente (talk) 11:28, 11 November 2020 (UTC)


 * It looks like you're just calling DATEDIFF incorrectly - it only takes two arguments. Yaron Koren (talk) 15:07, 11 November 2020 (UTC)


 * thank you very much for your quickl response. and yes, you are right. I am not calling DATEDIFF correctly with this interval parameter. I just assumed that it works similiar to the SQL function. There DATEDIFF also returns the difference between two dates in years, months or some other parameter values. Would it be possible to integrate a third interval parameter, although I know, that there are more important features/fixes to add to cargo. --Shuitavsshente (talk) 06:11, 12 November 2020 (UTC)

Replacement table stuck, can't recreate
Hello,

I help maintain the Dauntless Wiki on Gamepedia, and we're having a weird issue with Cargo. Our "Perks" table had a duplicate entry (Molten), so I tried to recreate the data to fix it and Molten disappeared from the table entirely. Now, I can't even recreate the table; it says it's stuck making the replacement table, which I can't access. Not really sure what to do here.

Thanks, MaximumLeech (talk) 16:21, 11 November 2020 (UTC)


 * What do you mean by "stuck"? What does it actually say? Yaron Koren (talk) 16:28, 11 November 2020 (UTC)


 * The template page says "This template defines the table "Perks". Create data table A replacement table has been generated for this table; View replacement table." which I found odd. Clicking "Create data table" brings up a page that says "Cannot currently recreate the table "Perks"; the replacement table "Perks__NEXT" still exists. (View replacement table)". When I click the replacement table, it pulls up a white screen that says


 * "MediaWiki internal error.


 * Original exception: [6919be70323902e8] 2020-11-11 17:12:01: Fatal exception of type "MWException"


 * Exception caught inside exception handler.


 * Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information." MaximumLeech (talk) 17:14, 11 November 2020 (UTC)


 * That's unfortunate. I think that's a bug that was fixed in May (i.e, version 2.6), but it may take a while before it reaches you. Until then, I think your best course of action might be to get an administrator to go into the database and delete the table "Perks__NEXT" (which is really "cargo__Perks__NEXT"). That, I think will take care of the problem. Yaron Koren (talk) 17:24, 11 November 2020 (UTC)