Extension talk:Cargo

From mediawiki.org
Jump to navigation Jump to search

Every Date after 27-12 (include) in every year will be stored as the next year[edit]

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 (talkcontribs) 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[edit]

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:
|fields= _pageName=Catalogsnummer, File,Headline, CONCAT("style=background: #",Color1),Color2, Color3, Color4, Color5
|group by=Headline
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)
{| class="wikitable sortable"
! Catalogusnummer !! Uitgever !! Datering !! Kleur 1 !! Kleur 2 !! Kleur 3 !! Kleur 4 !! Kleur 5
|fields=_pageName=Page, Color1, Color2, Color3, Color4, Color5
|order by=Page ASC
The template Colortable defines the body of the table:
| [[: {{{1}}} ]] ||  ||  || style='background: #{{{2}}}' | #{{{2}}} || style='background: #{{{3}}}' | #{{{3}}} || style='background: #{{{4}}}' | #{{{4}}} || style='background: #{{{5}}}' | #{{{5}}} || style='background: #{{{6}}}' | #{{{6}}}

Error: table “Level” not found[edit]

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)
@Yaron Koren: 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:
    "success": ""
    "error": {
        "code": "internal_api_error_DBQueryError",
        "info": "[818b4c0f68a0e4e2c9c7303e] Caught exception of type Wikimedia\\Rdbms\\DBQueryError",
        "errorclass": "Wikimedia\\Rdbms\\DBQueryError"
    "servedby": "mw6"
--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 '<'[edit]

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[edit]

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:

|fields=_pageName=Title,Program_Name=Program Name,Month,Monthly_Time=Monthly Time,Technician
|where=Request_calendar_item.Month LIKE "%{{{Month|}}}%"
|link text=HERE
|parse values
|filename=Monthly Resources.csv

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.
{{#cargo_attach:_table=Request_calendar_item |Technician=String |Month=String |Monthly_Time=Integer }}
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?[edit]

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[edit]

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?[edit]

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. -- 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. -- 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...[edit]

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[edit]

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: {{#cargo_query:tables=New Home Builders|fields=_pageName,Coordinates|format=openstreetmaps}} 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)