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)
 * Here are the source text for the template Template:Composer and the form Form:Composer. I hard-coded the field types, but that didn't solve the problem for one field (GivenNames). Is this from coding errors or oversights?
 * The "GivenNames" one is not working because "string" is not an input type - it should be "text" (or something else). Yaron Koren (talk) 16:38, 20 May 2016 (UTC)
 * Fixed, thank you.--Egnatoff (talk) 18:25, 20 May 2016 (UTC)
 * The documentation [Extension:Cargo/Storing_data#Declaring_a_table] does show "String" as a pre-defined field type--64.118.28.179 18:03, 23 May 2016 (UTC)
 * It's a Cargo field type; it's not a Semantic Forms input type. (Both sets include a "text" type, which I know adds to the confusion.) Yaron Koren (talk) 19:00, 23 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)
 * I was able to use the one-step process successfully, but was not able to solve the problem of specifying the page name using the input field values from two fields. Here are the source text for the template Template:Composer and the form Form:Composer. In this version of the form, I used, which gave the error message, "The specified target page  is invalid." The same thing happened when I used  . Everything, including creating a new row in the Cargo table, works properly when I specify the page name as the value of a single field for which data are entered when the form is invoked and submitted.--Egnatoff (talk) 15:47, 20 May 2016 (UTC)
 * It should be "page name=   ". Yaron Koren (talk) 16:03, 20 May 2016 (UTC)
 * Works, thank you. I now understand my mistake.--Egnatoff (talk) 18:28, 20 May 2016 (UTC)

where HOLDS LIKE "%Text%" OR IS NULL
I have a join on sql query with a HOLD LIKE in the where clause. I just discovered that entries without a contact are missing, and it turns out because the Role field is empty and doesn't match the HOLD LIKE in where.

tables=Ident,Dates,Details,Contacts |join on=Ident._pageName = Dates._pageName, Ident._pageName = Details._pageName, Ident._pageName = Contacts._pageName |where=Contacts.Role HOLDS LIKE "%Lead%"

if I add something like " OR Contacts.Role IS NULL" I get an error...

Error: operator for the virtual field 'Contacts.Role' must be 'HOLDS', 'HOLDS NOT', 'HOLDS LIKE' or 'HOLDS NOT LIKE'.

Basically I want to be able to fill in the table with name of the Lead Role Contact if it exists, but not require the field. If I remove the where clause, the left outer join works, but I get lots of rows because each item has multiple contacts. Have you encountered this limitation or thoughts on how to work around it within allowed sql syntax? --Kc5vcx (talk) 18:43, 25 May 2016 (UTC)


 * I figured out a solution with IFNULL (added to wgCargoAllowedSQLFunctions)

|where=IFNULL(Contacts.Role HOLDS LIKE "%Lead%", 1)
 * --Kc5vcx (talk) 19:35, 25 May 2016 (UTC)

Fatal Error "MWException" upon trying to invoke View table
Hi Yaron,

After not getting any further with SD (see: https://www.mediawiki.org/wiki/Extension_talk:Semantic_Drilldown#Drilldown_partially_not_working) I am trying to follow your advise and I am trying to get Cargo working. As I have another issue (cannot get access via SSH to my host), I decided to try first on my PC, installing LAMP, Mediawiki, and my DB from www.cienagagrande.co. So what I have: Ubuntu 14.04.4 LTS, Apache/2.4.7 (Ubuntu), PHP Version 5.5.9-1ubuntu4.17 (apache2handler), mysql Ver 14.14 Distrib 5.5.49, for debian-linux-gnu (x86_64) using readline 6.3, Mediawiki 1.26.3. Cargo was installed apparently fine and in the database I can see the (empty) cargo__pages and cargp__tables. Trying to start with a most simple test I made the template "CGSM-Noticia" with

created the tabel, but than get on Table view the above mentioned fatal error.

Thanks for any advise!


 * It shouldn't be "Source of Page", it should be either "List  of Page", or maybe just "Page". I don't know if that's what is causing the error, though. Yaron Koren (talk) 23:05, 25 May 2016 (UTC)
 * Thanks, I'm still struggling and still have not really understood the extension, but I think the error must be something else. I have changed the code to

being "Source" the existing property name of type Text, assuming I can use it in order to transfer the containg values to the table=News....the error is the same.


 * Did you recreate the table after changing the template? You need to do that. Yaron Koren (talk) 10:22, 26 May 2016 (UTC)
 * Yes I did...I have the feeling it has to do with the LAMP setup at my home PC because also the SMW pages produce strange errors. When I create new pages with the forms they result in -1 namespace errors which, I think, indicates that s something wrong with the MySql in general, even though the db reports fine.
 * Ah - if you're getting strange errors with SD, SMW and Cargo, there may well be something wrong with your overall setup, like with the database. Yaron Koren (talk) 11:26, 29 May 2016 (UTC)
 * Fatal exception of type "MWException" - Solved! The reason -in my case- was the table/field name, containing a "-". Thus it should be noted in https://www.mediawiki.org/wiki/Extension:Cargo/Storing_data#Declaring_a_table that not only spaces are disallowed, but also this (and possibly other) special characters. Regards, Horst, 6 June 2016
 * That's great, that you found the issue. I just checked in a fix for hyphens in field names, so now hopefully it should work... Yaron Koren (talk) 18:27, 7 June 2016 (UTC)

Fatal exception of type MWException on RunQuery Template
Hello Yaron,

I'm trying to use the RunQuery special page to create a query form on my cargo database. This is the query form definition:

Formulaire utilisé par la 'page spéciale exécute requête MagDBQueryTest'.

This is the result template : Modèle d'affichage du résultat de requête. Elle est appelée via le formulaire Form:MagDBQueryTest.

(Mot Clé "") <-- INSERT CARGO QUERY HERE -->

Without any cargo query inserted in the template or with a request with no results, it's "work", I mean, the template is correcly called with the right value for  and I have got the 'no result' sentence on my page - but when I'm supposed to get some results, I have a "Fatal exception of type MWException" even if I use a query that works on another template page ... what's wrong doc ?

Thanks for help

Guillaume Prêcheur (talk) 15:12, 30 May 2016 (UTC)


 * What happens if you call the template in some page, like setting the text to be " "? Yaron Koren (talk) 20:12, 30 May 2016 (UTC)


 * The template works well outside of the RunQuery context ! Guillaume Prêcheur (talk) 07:38, 31 May 2016 (UTC)


 * Please add the following line to LocalSettings.php:

$wgShowExceptionDetails = true;
 * That way, you'll hopefully see a more informative error message. Yaron Koren (talk) 13:21, 31 May 2016 (UTC)
 * here it is :

[d3ea54aa] /wiki/index.php/Sp%C3%A9cial:RunQuery/MagDBQueryTest Exception from line 6347 of /var/www/html/wiki/includes/parser/Parser.php: Parser state cleared while parsing. Did you call Parser::parse recursively?

Backtrace:


 * 1) 0 /var/www/html/wiki/includes/parser/Parser.php(374): Parser->lock
 * 2) 1 /var/www/html/wiki/extensions/Cargo.0.10.last/CargoUtils.php(290): Parser->parse(string, Title, ParserOptions, boolean)
 * 3) 2 /var/www/html/wiki/extensions/Cargo.0.10.last/CargoQueryDisplayer.php(181): CargoUtils::smartParse(string, Parser)
 * 4) 3 /var/www/html/wiki/extensions/Cargo.0.10.last/CargoQueryDisplayer.php(139): CargoQueryDisplayer::formatFieldValue(string, NULL, CargoFieldDescription, Parser)
 * 5) 4 /var/www/html/wiki/extensions/Cargo.0.10.last/CargoQueryDisplayer.php(245): CargoQueryDisplayer->getFormattedQueryResults(array)
 * 6) 5 /var/www/html/wiki/extensions/Cargo.0.10.last/parserfunctions/CargoQuery.php(114): CargoQueryDisplayer->displayQueryResults(CargoTableFormat, array)
 * 7) 6 [internal function]: CargoQuery::run(Parser, string, string, string, string)
 * 8) 7 /var/www/html/wiki/includes/parser/Parser.php(3753): call_user_func_array(array, array)
 * 9) 8 /var/www/html/wiki/includes/parser/Parser.php(3471): Parser->callParserFunction(PPTemplateFrame_DOM, string, array)
 * 10) 9 /var/www/html/wiki/includes/parser/Preprocessor_DOM.php(1179): Parser->braceSubstitution(array, PPTemplateFrame_DOM)
 * 11) 10 /var/www/html/wiki/includes/parser/Parser.php(3623): PPFrame_DOM->expand(PPNode_DOM)
 * 12) 11 /var/www/html/wiki/includes/parser/Preprocessor_DOM.php(1179): Parser->braceSubstitution(array, PPFrame_DOM)
 * 13) 12 /var/www/html/wiki/includes/parser/Parser.php(3281): PPFrame_DOM->expand(PPNode_DOM, integer)
 * 14) 13 /var/www/html/wiki/includes/parser/Parser.php(1239): Parser->replaceVariables(string)
 * 15) 14 /var/www/html/wiki/includes/parser/Parser.php(405): Parser->internalParse(string)
 * 16) 15 /var/www/html/wiki/extensions/SemanticForms-3.4.1/specials/SF_RunQuery.php(99): Parser->parse(string, Title, ParserOptions)
 * 17) 16 /var/www/html/wiki/extensions/SemanticForms-3.4.1/specials/SF_RunQuery.php(30): SFRunQuery->printPage(string, boolean)
 * 18) 17 /var/www/html/wiki/includes/specialpage/SpecialPage.php(363): SFRunQuery->execute(string)
 * 19) 18 /var/www/html/wiki/includes/specialpage/SpecialPageFactory.php(584): SpecialPage->run(string)
 * 20) 19 /var/www/html/wiki/includes/MediaWiki.php(275): SpecialPageFactory::executePath(Title, RequestContext)
 * 21) 20 /var/www/html/wiki/includes/MediaWiki.php(584): MediaWiki->performRequest
 * 22) 21 /var/www/html/wiki/includes/MediaWiki.php(435): MediaWiki->main
 * 23) 22 /var/www/html/wiki/index.php(46): MediaWiki->run
 * 24) 23 {main}
 * Guillaume Prêcheur (talk) 14:06, 31 May 2016 (UTC)


 * You're using old versions of Cargo and Semantic Forms - try upgrading both. Yaron Koren (talk) 14:44, 31 May 2016 (UTC)
 * I upgrade Cargo-1.0.1 and SemanticForms-3.4.1 ... same issue -
 * I'm running MediaWiki (1.24.1) and SemanticMediaWiki(2.1.1)
 * Do I need to upgrade them or to run a php update.php ??

Guillaume Prêcheur (talk) 14:46, 31 May 2016 (UTC)
 * Your MW is fine, and SMW is probably irrelevant. But you should be using the latest SF, 3.6. No need to call update.php. Yaron Koren (talk) 16:47, 31 May 2016 (UTC)
 * Sorry I already updated to SF 3.6 as you told me (but made a mistake typing the message) - same exception :-( Guillaume Prêcheur (talk) 07:29, 1 June 2016 (UTC)
 * Oh well. What does the query look like? Yaron Koren (talk) 13:32, 1 June 2016 (UTC)
 * Here is my query included in the template. This template works well when embeded into an another page - it only faild when accessed from the RunQuery ! Guillaume Prêcheur (talk) 07:15, 2 June 2016 (UTC)

Cette page correspond au modèle d'affiche du résultat de requête de test. Elle est appelée via le formulaire Form:MagDBQueryTest. Requête : (Mots Clé "")

Is something missing here? The query itself isn't using anything that was passed in. Yaron Koren (talk) 15:28, 2 June 2016 (UTC)
 * Hello Yaron, this is actualy a fake query: to find the origin of the issue, I simplified the query code intentionnally, in the final application the "where" condition will be upgraded and will use the template's parameters, nothing missing - Guillaume Prêcheur (talk) 07:38, 3 June 2016 (UTC)
 * I found that the problem comes from the fields CONCAT and SUBSTRING parsing - If I remove these functions from the query (like following), the query works well !

|fields=MagDBCompetenceCollaborateur.Competence=Compétences,count(MagDBCompetenceCollaborateur._pageName)=
 * unfortunately, I need to use theses function to format my result ... Guillaume Prêcheur (talk) 14:06, 7 June 2016 (UTC)


 * I finally looked into this, and fortunately was able to duplicate the issue. I just checked in what I think is a fix; if you get the latest version from Git, hopefully the problem will go away. Yaron Koren (talk) 18:00, 10 June 2016 (UTC)
 * Nice - Unfortunately, I urgently had to rollback the Cargo and SemanticForms production installs repectivly to the 0.10 and 3.4.1 because of a access page error on the skill edition form - occured with the last releases. I let inform you when I get time to analyse this new issue ... Guillaume Prêcheur (talk) 09:25, 13 June 2016 (UTC)

Coordinates and precision
The Cargo documentation for storage of coordinates states:

But actually fieldName__lat and fieldName__lon are stored as standard float. This introduces a problem, as standard MySQL uses 4 digits after the decimal point, i.e. float(7,4). When using SemanticForms, coordinate inputs (and thus our data in fieldName__full) has a precision of 5 digits after the decimal point. Also Googlemaps is using 5 digits.

This results in a offset of ~3m of MapMarkers displayed via fieldName__full (e.g. #cargo_display_map ) or via fieldName__lat/fieldName__lon (e.g. #cargo_query ).

@Yaron: Could you change the fieldName__lat and fieldName__lon to float(8,5) on creating the database tables? Couldn't find it in the code myself...


 * Thanks for pointing out the error in the documentation. Do you think it would work to just change the MySQL representation from a Float to a Double? Yaron Koren (talk) 16:04, 1 June 2016 (UTC)

Multiple data output
Sorry for keeping on bothering....After having installed from scratch Mediawiki 1.26.2 and the latest Cargo version 1.0.1 (1d7e56f) 13:20, 6 June 2016 on http://www.zonacostera.info/CGSM and getting +/- acquainted to Cargo I initially was happy to see that my 145 pages of http://www.zonacostera.info/CGSM/Category:CGSM_-_Noticias are displayed fine, including the Drilldown. But now I see that the data pages are starting to show up double and triple...: http://www.zonacostera.info/CGSM/Special:CargoTables/CGSM_Noticias

The template code is:

This is a "CGSM en las noticias" item.

What am I doing wrong?? Thanks for any advise! Horst 7th June 2016 ....Just noticed one too many and deleted it...could that have been the reason? No, it s not...


 * Could it be that, over the course of setting up the data structure, you called "Recreate data" for the template more than once? In any case, the fix is to call "Recreate data" yet again... but make sure that all the previous recreating has completely finished. I do hope to get this working better, so that calling "Recreate data" wipes out all the pending jobs from before, but that hasn't happened yet. Yaron Koren (talk) 18:54, 7 June 2016 (UTC)
 * I certainly did...I shall try to be patient and than try again...but maybe there is a way to "hard reset"?.. or would it do any good to delete the table and than recreate?
 * You could delete everything in the "job" DB table, then recreate. Recreating already deletes the Cargo table. Yaron Koren (talk) 20:44, 7 June 2016 (UTC)

Database field to populate dropdown
I'm trying to use a database field to populate a dropdown box on a form but with no success. I've got a cargo table that holds a list of substances and want to use this list in another form to populate the values in a dropdown box.

This is the code that I'm using.

{| class="wikitable"

! Substance:

What I would expect is that the cargo query returns a comma delimited list of substances such as which it does if I just run the query directly in the page. But if I run it in the code as above I get one row in my dropdown box that contains

Is this a bug or am I doing something wrong?

Cheers.


 * That may be a bug, although thankfully there's an easier way to do this: " ". Yaron Koren (talk) 12:05, 10 June 2016 (UTC)

Brilliant, Thank you. This works a treat :)

Can't use for database results
I'm trying to add the result of a database query but get an error

I've set the field up in the database as an Integer and a Float but keep getting the same error, my code is

Any help is appreciated.


 * It's too bad that that's not working - it seems like this is the same issue as above, where nesting #cargo_query fails. Unfortunately, adding the math into the query - i.e., making the field name "Revision + 1" - will also fail, because Cargo's parsing doesn't handle that. The only solution I think of is to create a Lua module for this, using the Scribunto extension - see here. I wish there were an easier way. Yaron Koren (talk) 16:29, 10 June 2016 (UTC)

I've just tried Lua but am having trouble getting the result back. Here's my LUA script.

local p = {} local cargo = mw.ext.cargo local result = {}

function p.Rev( frame ) tables = 'Substance' fields = 'Revision' local args = { where ='Substance="Cleaner" ', limit = 1 } result = cargo.query (tables, fields, args) return result

end return (p)

and I'm calling this with..

And the result that it gives me back is 'table' instead of returning the contents of the result.