Extension talk:Cargo

Trouble Adding Table to a particular Template
For the life of me I can't see to get a particular template to create tables. I'm starting with Page Schemas and have something like this...

    Author  text   Text    Update</Label>  text</InputType> </semanticforms_FormInput>  Text</Type> </cargo_Field> </Field> </Template>

This is my actual template that gets generated:

This is the "Status" template. It should be called in the following format: &lt;pre>

&lt;/pre> Edit the page to see the template text.

Originally it was a multiple instance, with a datefield, author (user page), and textbox/wikitext. I've tried changing the name, order, datatypes, etc. My other templates are coming through but not this one or anything like it. I execute runJobs on cmd line. In the API url call I get something like this...

/api.php?action=cargorecreatetables&template=Status

{   "error": { "code": "internal_api_error_DBQueryError", "info": "[7817f089] Database query error" } }

Usually I get an error when I then try to edit the page with form stating the table doesn't exist, but what's weird is that eventually the form works and I can edit data, but no data is stored to the database, and still no table for this one actually exists in the mysql database.

If I run cargoRecreateData it seems to skip this template also.

I appreciate any direction to help debug this.--Kc5vcx (talk) 03:01, 2 November 2015 (UTC)


 * My guess is that the field called "Update" is causing the problem, because that is already an SQL keyword. If so, that's a bug in Cargo - it should either handle that name or reject it. Please let me know, though. Yaron Koren (talk) 14:13, 2 November 2015 (UTC)


 * Ahh, yes, that's it! Thanks, works now after renaming the field. --Kc5vcx (talk) 15:22, 2 November 2015 (UTC)

Timeline output format displays blank box
Here's the question I was going to ask: The timeline format (as here) would be ideal for my data, but unfortunately all I get is a blank space. It is exactly the same as the example on discoursedb.org, and similar to the example on mwstake.org. I'm using MW1.25.3 and Cargo 0.6.

Then I realised I should use Cargo 0.10 so did "get checkout master". It all works fine now. So don't use the REL1_25 branch with MW 1.25.3 :-)

Also the calendar format showed an empty calendar on the iPhone but that also now works fine. Jonathan3 (talk) 19:19, 5 November 2015 (UTC)

Timeline and calendar formats don't work properly with Foreground skin tabs
I would like to use three tabs for an events page - for Table, Timeline and Calendar formats.

Each format works fine, one after the other, without using tabs. But...

In tab 1, only Table and Timeline work. Calendar does not.

In tabs 2 or 3, only Table works. Calendar and Timeline do not.

Is there something I can do to fix this?

The tabs are done as follows. Each "section" is a tab.



<p class="title" data-section-title>Timeline ...

It looks similar to the problem here though probably is unrelated. Jonathan3 (talk) 20:48, 5 November 2015 (UTC)

I have discovered that the timeline format DOES work, in any tab, if there is a cargo query outside the tabs structure on the same page. Jonathan3 (talk) 20:57, 5 November 2015 (UTC)


 * I would check the JavaScript console for errors, if you know how to do that. Also, does this only happen with the Foreground skin? Yaron Koren (talk) 01:16, 6 November 2015 (UTC)


 * Thanks Yaron. The problem isn't there for the Vector skin (the tabs don't show as tabs with Vector, but everything appears one after the other - as it does with Foreground if you don't use tabs).
 * I got the following error initially:

Test_page:1 XMLHttpRequest cannot load http://domain.co.uk/index.php?title=Special:CargoExport&tables=Event&&fields=_pageName%2CDate&&order+by=_pageName&limit=100&format=timeline. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.domain.co.uk' is therefore not allowed access.
 * After adding a str_replace to add the www that error stopped appearing (I don't really understand this to be honest so it may have coincided with something else).
 * Also I was getting an error "Caught exception: SyntaxError: Unexpected end of input" which may have been related, and which also no loger appears.
 * The only other things are just lots of "Use of "wgCargoMonthNamesShort" is deprecated. Use mw.config instead."
 * Jonathan3 (talk) 02:22, 6 November 2015 (UTC)


 * So, you're no longer getting errors? (You can disregard those warnings.) And is the actual problem still happening? Yaron Koren (talk) 02:43, 6 November 2015 (UTC)


 * Sorry for not being clear. It all seems so random to me so I'm just trying different things. I'm not getting those errors any more but the original problem persists (plus at the moment timeline format doesn't work in tab 1 either). I'll email you a URL if that would help (I don't want to publish it). Jonathan3 (talk) 02:47, 6 November 2015 (UTC)


 * Ah - yes, please do. Yaron Koren (talk) 02:51, 6 November 2015 (UTC)

Are "Semantic_Extra_Special_Properties" meta data not available for Cargo either ?
If yes I suggest to add "Semantic Extra Special Properties + SMW" in the line "Storage of page metadata"/column "SMW-based system" of the "Features checklist" in the page Extension:Cargo/Cargo_and_Semantic_MediaWiki.

Cheers,

Nicolas NALLET (talk) 16:03, 6 November 2015 (UTC)


 * Good point - I just added it in. Yaron Koren (talk) 16:49, 6 November 2015 (UTC)

Advanced SQL Joins in cargo_query for multiple instance templates
I'm probably over complicating things in my data store, but I'm building a project tracker on SMW using Cargo. Our projects can have multiple milestones with planned/expected/actual dates I want to track. Rather than hard-coding a potential list of these milestones and respective dates (this list could get long) in my form, I made a multiple instance dates template where somebody can select from usual milestones and add others. The problem is I then need to link it back to the project and this obviously complicates the query. It's been awhile since I've done SQL but I can accomplish what I want in phpmyadmin with something like this...

select Projects._pageName,Dates.Planned_Design_Start from cargo__projects Projects JOIN (select _pageName, Planned_date as Planned_Design_Start from cargo__project_dates where Milestone="Design Start") Dates ON Projects._pageName = Dates._pageName

Unfortunately a simple join doesn't really organize the way I need and produces something like this...

Not sure why the aref's aren't coming through here, but that's not part of the issue on my real page.

I'm assuming I need to translate my data more directly like the first example for the various results formats to process it, but I'm just getting there. I was trying to embedded it in the cargo syntax, maybe put the join in the tables= field, but it obviously won't let me use SELECT for the subquery, and $wgCargoAllowedSQLFunctions in localSettings.php also won't let me allow it. Obviously I could simplify my data structure and that's why I'm working through this, but wanted to explain my example to help justify. Any thoughts on enabling something like this or how I might hack around it? Might be nice if I could just give it a raw sql query (this is on a secure internal network, so less concerned about security).

Also, as I'm debugging, is there a good way to display the raw sql query text it generates like at the top of the page with a variable? I can introduce some types of errors and get it, which I've found helpful debugging what I'm trying to do with my data.

Thanks again.--Kc5vcx (talk) 18:35, 6 November 2015 (UTC)


 * Hi - I think I see the issue: you want to show more than one "row" of data from that "Dates" table across the same row of results. Unfortunately, I don't think you can do that with a call to #cargo_query, given its constraints. There is one way, if you use a "template" format and then include a query within that template; but that's a hack, and anyway it won't let you display anything more interesting than a (hacked-together) table. What I would suggest instead is to hardcode the fields for "planned date" and "expected date", since every page should have those. And if there are other dates that you'd expect every page to have, I'd hardcode those as well. Actually, maybe it's better to hardcode everything, unless there are really a lot of other date types, in which case you can use that setup you came up with for all the other types.
 * A "debug" format would be great; I keep meaning to add that in. Yes, I too introduce errors in order to see the SQL, which is not great. Yaron Koren (talk) 19:39, 6 November 2015 (UTC)


 * I found I can sort of do what I want my concatenating the field names in a compound query, in this case to send to the calendar result format, like so...

However, there's something wrong with the AS statement on a date field because the calendar format equivalent is empty. If I remove the =date field, then I get the first query on my calendar, but not the second because it's in a second column. It looks like cargo is including the __precision table in the query behind the scenes and I presume formatting it correctly to send to the calendar. Using the = in fields which correlates to the SQL AS for alias, looses this formatting or whatever. I seem to need to be able to combine my dates all into one column for them to show up on the calendar. So is there a way to force the date formatting calendar needs? I've been trying the DATE and DATE_FORMAT functions on both sides.--Kc5vcx (talk) 22:38, 6 November 2015 (UTC)


 * This was indeed a bug, and the problem lay with the 'precision" fields like you said. Thanks for diagnosing it. I believe I just fixed it in the Cargo code. Yaron Koren (talk) 00:48, 11 November 2015 (UTC)


 * Thanks, I'm still having a bit of an issue though after playing with my sample above. For some reason only one (maybe the last) of the second query in the compound query gets put on the calendar.  What I'm trying to do is have color coded events, blue is the default planned date.  A second red calendar shows where the expected date is not equal to the planned.  If I use a format table I see a couple applicable entries, but in the calendar format only one shows up in red and the others not at all.  Is there anything different in the data output between them?  I confirmed they're all the same simple looking date format in mysql with precision 1.  The rest of the blue are there and shouldn't conflict with names or dates.  I haven't been able to figure out another way to view the raw calendar data to further debug.  Any thoughts? --Kc5vcx (talk) 16:41, 11 November 2015 (UTC)


 * There's a way to view the raw calendar data, though it's a little bit of a hassle; I use it all the time, though: (1) View the page source, and find the URL that includes "Special:CargoExport". (2) Replace all the "&amp;amp;"s in the URL with just "&"s. (3) Add a "start=" and "end=" value to that URL, representing the range of dates you want to find, like "&start=2014-01-01&end=2015-01-01". (4) Go to that URL. Yaron Koren (talk) 00:10, 12 November 2015 (UTC)


 * As I suspected the raw calendar data is a subset that I get in the table or even the csv format, so something else in the processing is filtering it out. The functions for the different types look significantly different in the export code with additional date stuff for the calendar, if I get anywhere looking at it I'll update.--Kc5vcx (talk) 16:48, 12 November 2015 (UTC)


 * UPDATE: If I comment out the below section where it appends the start/end dates to the where clause of the query I get my expected result. There must be something conflicting with the multiple dates, but not obvious to me yet without seeing the produced sql.

$where = $sqlQuery->mWhereStr; if ( $where != '' ) { $where .= " AND "; }			$where .= "(";			foreach ( $dateFieldRealNames as $j => $dateField ) {				if ( $j > 0 ) {					$where .= " OR ";				}				$where .= "($dateField >= '$startDate' AND $dateField <= '$endDate')";			}			$where .= ")"; $sqlQuery->mWhereStr = $where;


 * Is there any particular reason for this rather than the user limiting the results on their own? --Kc5vcx (talk) 20:55, 12 November 2015 (UTC)


 * It's because the calendar only shows one month/week/day at a time; so the page only queries for results from that time period. Yaron Koren (talk) 21:04, 12 November 2015 (UTC)

Job run rate "too high"?
The Known bugs and planned features page states: "If a table is recreated via the web interface and the "job run rate" (set via $wgJobRunRate) is too high, it can lead to some pages not getting their data stored." What is too high? Alternatively, what range is all right (e.g. 0.1 to 1)? Thanks Jonathan3 (talk) 20:51, 6 November 2015 (UTC)


 * I don't know; I should do more testing. I think it's worked for me fine with a rate of 1, but caused problems when I used a rate of 10. Yaron Koren (talk) 21:54, 6 November 2015 (UTC)


 * Thanks for explaining. Jonathan3 (talk) 22:24, 6 November 2015 (UTC)

Boolean field always 0 in database
I have a boolean field ("Active" in a "Jobs" adverts table). When I create the job page using Semantic Forms, the tick box makes it "Yes" or "No" as appropriate. But when it appears in the Cargo database table it's always 0. I'm sure I'm missing something simple..... Thanks Jonathan3 (talk) 22:28, 6 November 2015 (UTC)

P.S. When I edit the database directly (changing one of the 0s to 1) it is reflected in the Special:CargoTables/Jobs page, but when I "recreate data" on Template:Jobs it returns everything to 0. Jonathan3 (talk) 22:40, 6 November 2015 (UTC)

P.S. And when I change the Job page so that "Active" is "1" (instead of "Yes") this leads to Special:CargoTables/Jobs page showing 1. So I suppose I need to know either: (a) how to get SF to make the values 1/0 rather than Yes/No, or (preferably) (b) how to get Cargo to recognise "Yes" and save "1" to the database.Jonathan3 (talk) 22:46, 6 November 2015 (UTC)


 * I was going to try to help, but I just realized the same thing is happening to me. --Kc5vcx (talk) 22:50, 6 November 2015 (UTC)


 * Yikes! It looks like the setting of Boolean values never worked correctly. I guess it's not a very popular type. Sorry about that; I think I just fixed the problem in the Cargo code. Yaron Koren (talk) 20:20, 8 November 2015 (UTC)


 * Looks fixed to me. --Kc5vcx (talk) 16:41, 11 November 2015 (UTC)

Error: the SQL function "AND" is not allowed.
When I use the following query I get the error in the topic title: |where=Active=1 AND (Closes >= NOW or Closes IS NULL)

But when I use this it works fine: |where=(Closes >= NOW or Closes IS NULL) AND Active=1

For future reference, where am I going wrong? Jonathan3 (talk) 23:13, 6 November 2015 (UTC)


 * That was a bug - sorry about that! I just fixed it in the code. Yaron Koren (talk) 19:16, 10 November 2015 (UTC)


 * Thank you very much (again). Jonathan3 (talk) 18:58, 11 November 2015 (UTC)

Date precision
Here is written about the possibility of storing of incomplete dates (year or year+month). But I was not able to set incomplete dates by #cargo_store. What is the syntax for this? --StasR (talk) 15:41, 17 November 2015 (UTC)


 * There's no special syntax - the code tries to figure out the precision of each date. What was the date you tried to set, and what happened? Yaron Koren (talk) 17:00, 17 November 2015 (UTC)


 * Template:Cargo1


 * Page


 * View table

This table has 8 rows altogether. Page   descr       value Cargo2 31.03.2014  2014-03-31 Cargo2 2014-03-31  2014-03-31 Cargo2 .03.2014    1970-01-01 Cargo2 2014-03-    1970-01-01 Cargo2 03.2014     1970-01-01 Cargo2 2014-03     2014-03-01 Cargo2 2014        2014 Cargo2 2011        2010
 * Database content

_ID descr       value     value__precision 1 31.03.2014  2014-03-31  0               2  2014-03-31  2014-03-31  0               3  .03.2014    1970-01-01  0               4  2014-03-    1970-01-01  0               5  03.2014     1970-01-01  0               6  2014-03     2014-03-01  2               7  2014        2014-01-01  3               8  2011        2011-01-01  3
 * I realized that the syntax is defined, but there are problems in Table View ("2014-03" → "2014-03-01" and "2011" → "2010"). In addition, value__precision for complete date contradicts its description (0 vs. 1). --StasR (talk) 18:07, 17 November 2015 (UTC)


 * There were a few issues there. The date parsing obviously is not perfect - Cargo uses PHP's own date parsing, for what it's worth. Although those failing dates are in rather awkward formats; are there any that would specifically be useful to handle correctly? The year-off-by-one thing was strange; I just checked in a fix for that. Thanks for letting me know. As for the "precision" field showing the wrong value, I'm guessing that's just because you're using an older version of Cargo. Yaron Koren (talk) 20:08, 17 November 2015 (UTC)


 * I use Cargo REL1_25. Cargo master and MW 1.25 — is it good? --StasR (talk) 21:33, 17 November 2015 (UTC)


 * Cargo master View Table:

This table has 8 rows altogether. Page   descr       value Cargo2 31.03.2014  2014-03-31 Cargo2 2014-03-31  2014-03-31 Cargo2 .03.2014    1970-01-01 Cargo2 2014-03-    1970-01-01 Cargo2 03.2014     1970-01-01 Cargo2 2014-03     март 2014       - formally OK, but long form :-( Cargo2  2014        2014 Cargo2  2011        2011            - OK!!! --StasR (talk) 21:44, 17 November 2015 (UTC)


 * Great! I think spelling out the month name, when it's only the month and year, is good - don't you agree? That's the usual way it's written out. As for the three failing syntaxes, are there any that you think are a problem? Yaron Koren (talk) 00:47, 18 November 2015 (UTC)
 * The problem with the wrong year left (the master version is only shifted):


 * And about long forms. It is very good for 'View table', but very inconvinient for templates etc. --StasR (talk) 07:36, 18 November 2015 (UTC)


 * Oops! I forgot to add in that same fix for year/month-only dates. I just checked in what I think is a fix. As for the month formatting: if you want a specific format for the date, I would recommend using the DATE_FORMAT function within the query, as opposed to doing formatting within a template. Wouldn't that work? Yaron Koren (talk) 14:39, 18 November 2015 (UTC)


 * Yes, I will use the DATE_FORMAT function. Thanks for the help! --StasR (talk) 14:57, 18 November 2015 (UTC)


 * I tried. It turns VERY inconvenient. I need to read the date (probably incomplete) for further processing. The DATE_FORMAT function (even if it will work) is not intended for incomplete dates. The '__precision' field can not be obtained through '#cargo_query'. I have to use regexps and an array of month names to calculate what really is stored in the database in the required format. --StasR (talk) 07:38, 26 November 2015 (UTC)


 * It's true that, if you want to have a different custom display for different date precisions, the system does not make it easy to do. The issue isn't with DATE_FORMAT, since all dates passed in to it are technically at full precision; but having the "__precision" field available in queries might indeed make things much easier - I'll have to look into that. Yaron Koren (talk) 13:31, 26 November 2015 (UTC)


 * I just added in (re-added, really) the ability to display date precision fields in the query. Is that by itself enough to get this working, though? Or would you also need the ability to call "CASE", or something like it, in the "fields=" parameter? Yaron Koren (talk) 15:36, 30 November 2015 (UTC)
 * Thank you. I think that is enough. --StasR (talk) 17:17, 30 November 2015 (UTC)

Update to 0.10 version - make my sql request on error ( function SUBSTRING_INDEX)
Hello Yaron, I'm back, still using your Cargo ! I tried to update my cargo to the last 0.10 version, but I have this error message : Error: the SQL function "SUBSTRING_INDEX" is not allowed. Allmost all my queries are concerning by this pb ... here one exemple of such a query : Guillaume Prêcheur (talk)


 * Hi Guillaume! Yes - the variable $wgCargoAllowedSQLFunctions was added, so you just need to add that function to it; see here. Yaron Koren (talk) 14:47, 18 November 2015 (UTC)
 * I try to add this setting wgCargoAllowedSQLFunctions line after the Cargo inclusion, but still have an SQL error (Error: the SQL function "COMPETENCE:',COMPETENCE,'|',SUBSTRING_INDEX" is not allowed.) for the same request - with this settings :

require_once( "$IP/extensions/Cargo.0.10/Cargo.php" ); $wgCargoAllowedSQLFunctions[] = 'SUBSTRING_INDEX'; Am I wrong again somewhere ?--Guillaume Prêcheur (talk) 16:26, 18 November 2015 (UTC)


 * I think you're running into a bug that I may have fixed last week; I would recommend getting the latest version of the code, if you're not using that now. Yaron Koren (talk) 16:35, 18 November 2015 (UTC)
 * I'm using the downloaded zip one. I'll try with the git version.--Guillaume Prêcheur (talk)
 * I tried with the master branch of the git sources. Same problem :-(. --Guillaume Prêcheur (talk)


 * Alright. What is the exact query you're calling, that leads to this error? I assume it's not the one from above. Yaron Koren (talk) 15:27, 19 November 2015 (UTC)
 * The query is the same that the one above (I add some  tags to display it completly !) --Guillaume Prêcheur (talk)


 * Ah, now it makes sense. And that's very interesting - it looks like your query had a rather specific combination of punctuation that Cargo's parsing failed on. I just checked in what I think is a fix - if you update your code, hopefully it will work correctly. Yaron Koren (talk) 14:19, 20 November 2015 (UTC)


 * Ok the first query is now working. But this next one need the declaration of CHAR

If I simply 2 lines It doesn'work (CHAR is not allowed) I tried something like : It's still doesn't work - what'is the right syntaxe to add 2 functions ? --Guillaume Prêcheur (talk)
 * 1) $wgCargoAllowedSQLFunctions[] =  'CHAR'
 * 2) $wgCargoAllowedSQLFunctions[] =  'INDEX_SUBSTRING'
 * 1) $wgCargoAllowedSQLFunctions[] =  array('CHAR','INDEX_SUBSTRING');


 * Ah - you've found another bug. Sorry about that. This one only happens with recent versions of MediaWiki (1.25.3 or higher). If you get the latest version of Cargo, the problem should go away - and then you should use the first of those approaches. Yaron Koren (talk) 17:50, 20 November 2015 (UTC)


 * Yep - It works ! You fixed it ! thanks - --Guillaume Prêcheur (talk)

Changing lots of content at once
If I were to have a table with "Content" (wikitext) and "Accurate as at" (date) for the columns, is there an easy way to change the dates of multiple pages/rows? For instance, for periodic checks that the content is still accurate, so that readers can be assured that the content is up to date. I imagine that Extension:Replace Text might work, but is there another way? Thanks Jonathan3 (talk) 15:45, 18 November 2015 (UTC)


 * I would think Replace Text would be the easiest approach. (I don't know how useful that "Accurate as at" field actually would be, but that's another story...) Yaron Koren (talk) 15:58, 18 November 2015 (UTC)


 * Thanks. I'm interested in your views on the date field... Jonathan3 (talk) 21:42, 18 November 2015 (UTC)


 * Well, how informative is that field if it's just going to be updated en masse? It doesn't inspire a lot of confidence that anyone is actually checking the accuracy of each page. Yaron Koren (talk) 22:15, 18 November 2015 (UTC)


 * I see what you mean, but: (a) it boils down to how much people trust the site already; (b) in all likelihood I'll be checking multiple pages each time rather than all pages en masse, just becuase of time constraints, which would lessen your concern; (c) I think Cargo will be useful because I will be able to (for my own purposes) list pages by last-checked-date to prioritise future checks. Jonathan3 (talk) 22:24, 18 November 2015 (UTC)

Changing structure of database once created
I guess this may have the same answer as my other question (about changing lots of data at once) - when you have created your data structure, template, form, etc, is there an easy way, for example, to add a column or change a column name, without having manually to edit all the pages? Thanks Jonathan3 (talk) 15:48, 18 November 2015 (UTC)


 * Sure - just change the template and form, and recreate the Cargo table. The pages that call that template don't need to be changed, although if a field name changes, that's probably a good idea. Yaron Koren (talk) 17:10, 18 November 2015 (UTC)


 * I guess that if a field name changes, the pages calling the relevant template would all need to be changed, as otherwise the data wouldn't end up in the Cargo table - is that right? Looking at Replace Text, it looks like you would just use the "Replace only in category" filter to change only the relevant pages. Jonathan3 (talk) 22:29, 18 November 2015 (UTC)


 * That's right. Yaron Koren (talk) 23:09, 18 November 2015 (UTC)

DATE_FORMAT problem
has type Text,  is the same text, but has type Date.

Result is: --StasR (talk) 09:02, 21 November 2015 (UTC)


 * Yes, you found another bug - sorry about that. I'm guessing you were the first person to try using DATE_FORMAT. I just fixed this in the code, I think. Yaron Koren (talk) 15:08, 22 November 2015 (UTC)

Request for new function : Template label for bar chart format output
Hello Yaron, I would like to be able to display bar chart labels throw templates to create links to pages for instance.

The image above corresponding of what I dreamed about.

--Guillaume Prêcheur (talk)


 * You may recall that you asked for something similar a few months ago. Unfortunately, the answer is still the same: links would be difficult to implement within the bar chart display. Yaron Koren (talk) 18:42, 25 November 2015 (UTC)

Request for new function : SQL function processing and template evaluation for exhibit format output
Hell Yaron (again) I'm trying the exhibit format queries output to help my users navigating into my skill database.

Sql functions
I'm using sql string formating functions into the field definition of my queries to format the labels. Example : ... fields=CONCAT(,SUBSTRING_INDEX(MagDBCompetenceCollaborateur.Competence,'/',-1),)=Compétences ) ...



The exhibit output doesn't take in account the functions into the selection views. In the image above the string before the "\" should not be desplayed (ok for the and  )

template in the result tab


The exhibit output doesn't evaluate wiki syntaxe into the result view : In the image above :
 * column Label : the string before the "\" should not be desplayed and the label should be displayed as a link
 * column Collaborateur: the template is not evaluated.

--Guillaume Prêcheur (talk)

Columns hard coded in UL and OL formats
Tried to use the column parameter for the UL and OL formats but any time you add any number other than 1 you get three columns. Looked at the files for the OL and UL formats and 3 columns is hard coded for anytime the number isn't 1. --Cody3647 (talk) 01:04, 29 November 2015 (UTC)


 * Ah, that's true! Sorry about that. Maybe I never tested it with a value other than 3. This is fixed now, in the latest code. Yaron Koren (talk) 15:38, 30 November 2015 (UTC)

Did not find alias for special page
Just FYI (low priority), I'm seeing these Warnings in the debug console for Cargo when I goto the special pages main page.

Warning	Did not find alias for special page 'CargoTables'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'DeleteCargoTable'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'ViewData'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'Drilldown'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'GetData'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'GetData'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'CargoTables'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'DeleteCargoTable'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'Drilldown'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor Warning	Did not find alias for special page 'ViewData'. Perhaps no aliases are defined for it? SpecialPageFactory::getLocalNameFor

Looks like common issue/fix mentioned here:

Manual:Notices_and_error_messages

--Kc5vcx (talk) 17:33, 30 November 2015 (UTC)


 * Thanks for the suggestion; I just added in an alias file. (Although Special:GetData comes from External Data - it could probably use an alias file too). Yaron Koren (talk) 00:25, 4 December 2015 (UTC)

Custom text if Date is NULL
I have fields which are declared as dates (I need to do date comparisons) and wonder whether it is possible in the (dynamic) table format to display some custom text (e.g. "Ongoing") when the date field is NULL. Sorry if the answer is really obvious. Jonathan3 (talk) 21:49, 30 November 2015 (UTC)


 * The only way I can think of to do that is to create another field in the Cargo table, which is of type String, and which is given the date if it's not null, or that custom text if it's null; and then display that in the query instead of the true date field. I don't know how it would look, though. Yaron Koren (talk) 23:56, 30 November 2015 (UTC)


 * Thanks. I guess that could be done with a MySQL trigger but sadly I'm running too old a version. Does Cargo have any feature that would help here? Jonathan3 (talk) 00:20, 1 December 2015 (UTC) P.S. I doubt it, and am sure I would need to do it manually, but thought it worth asking Jonathan3 (talk) 00:21, 1 December 2015 (UTC)


 * Just use an #if call within the #cargo_store call. Yaron Koren (talk) 00:53, 1 December 2015 (UTC)

Format timeline error
Hi Yaron, I'm trying the timeline query format, I have got this error message : Caught exception: SyntaxError: expected expression, got ')' My template is : the query works (and return me a date) with default format. Any idea ? --Guillaume Prêcheur (talk) 11:31, 1 December 2015 (UTC)


 * Where are you seeing that error message? And is there a line number or something for it? Yaron Koren (talk) 15:31, 1 December 2015 (UTC)


 * The message appear in a popuped message window- no line number - It occurs when displaying the template page or the page containing the template page.

--Guillaume Prêcheur (talk) 09:10, 2 December 2015 (UTC)


 * No idea. Are you using the latest version of Cargo? I should note that it's strange to just display the date, and not any other fields, although it should still work. Yaron Koren (talk) 14:00, 2 December 2015 (UTC)

SQL error on Example
I noticed a SQL error on your following page : http://discoursedb.org/wiki/Colombia-United_States_Free_Trade_Agreement --Guillaume Prêcheur (talk) 11:35, 1 December 2015 (UTC)


 * Thanks for letting me know about that; I just fixed it. Yaron Koren (talk) 15:32, 1 December 2015 (UTC)

SQL error on my forms ..
Hello Yaron,

Still trying to upgrate to the 0.10 version, but i notice a new error message on my projet's editing form :

A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script Query: SELECT `cargo__MagDBProjets__Client_direct`._value AS "Client direct" FROM `cargo__MagDBProjets` LEFT OUTER JOIN `cargo__MagDBProjets__Client_direct` ON ((`cargo__MagDBProjets`._ID=`cargo__MagDBProjets__Client_direct`._rowID)) GROUP BY `cargo__MagDBProjets__Client_direct`._value HAVING `cargo__MagDBProjets__Client_direct`._value ORDER BY 200 LIMIT 100 Function: CargoSQLQuery::run Error: 1054 Unknown column '200' in 'order clause' (localhost)

My template is pretty large, I didn't dump it in this page, let me know if you need it to investigate, I'll send you as a imported file or just an extract ..

Thanks. --Guillaume Prêcheur (talk) 12:22, 1 December 2015 (UTC)


 * What version are you running? And what does the " " tag look like for the "Client direct" field? Yaron Koren (talk) 15:33, 1 December 2015 (UTC)
 * This message occurs when I jump to the 0.10 cargo version (git update 23/11/2015 10:59) - MediaWiki 1.24.1 - Semantics Forms 3.1 - Semantic MediaWiki 2.1.1 - Semantic Forms Input 0.7

Nothing special on the " " tag - here is an extract on my Form definition : * Ceci est le formulaire ... * Le modèle de données ... * Pour créer une page... * Pour tout renseignement ... * Pour tout renseignement ... <div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"> ... = Organisation = ...

Here is an extract of the template :

--Guillaume Prêcheur (talk) 09:26, 2 December 2015 (UTC)
 * If I hide the Client_direct field in the form, it return a error message concerning the next field ...
 * If I hide the {| class="formtable" ... |} it runs well (without the formtable ..)
 * If I hide the fields from Client_direct to the end of the form, it runs well (without the hidded fields)
 * I also tried to cut my formtable in two peaces ... doesn't work ...(even if I just add one field in the second formtable (Fournisseurs for instance))


 * Aha - my guess is that this issue will go away if you upgrade your version of Semantic Forms. Yaron Koren (talk) 14:02, 2 December 2015 (UTC)
 * It solve my pb - thanks --Guillaume Prêcheur (talk) 08:49, 3 December 2015 (UTC)

duplicate entries in cargo sql tables
I'm seeing duplicate entries in my cargo sql tables. I have a test page using a form, I hadn't editing it for at least a day (other users editing pages in same category, but not using forms yet). Today I had like 9 rows for the same page, I thought maybe all the test edits I had done before caused the duplicates, but I just went and made a change, and it cleared back out to one. Maybe it was recreating the template, but that doesn't seem to be happening now. Seemed more like it happened on it's own. I think I could run the recreateData maintenance script but don't want to have to keep running it. I was looking at the possibility of letting somebody else run some advanced reporting outside of mediawiki, but didn't want to open that up if the data was messy. Thoughts? --Kc5vcx (talk) 04:10, 4 December 2015 (UTC)


 * This sometimes happens; it has something to do with jobs, but beyond that I don't know. I hope to fix it. Yaron Koren (talk) 13:12, 4 December 2015 (UTC)


 * I was trying to manually runjobs each time I modified the template pages, maybe not each time I edited or between quick edits. My system is internal and I'm not really worried about the load, is there a way to just force it to do all the updates inline rather than using job queue if this would help? --Kc5vcx (talk) 14:40, 4 December 2015 (UTC)

Format List of page inside a tab
hello Yaron In my model, I defined the project's management team as list of Page (as link to the User:Xxx page) |Equipe_de_management=List of Page Inside a tab format query the field returned looks like : Xxx,Yyy,Zzz How can I do to format this result to produce something like Xxx] [[User:Yyy|Yyy] [[User:Zzz|Zzz] ? --[[User:Gpr-mw|Guillaume Prêcheur (talk) 14:43, 4 December 2015 (UTC)


 * What's a tab format query? Also, does that field right now link to the page "Xxx", or the page "User:Xxx"? That wasn't clear to me. Also, do you know about #arraymap? Yaron Koren (talk) 14:54, 4 December 2015 (UTC)
 * this is a dynamic table format - the content of the field is Xxx (so the result propose a link to the Xxx page) - Can I use #arraymap inside a tab ?


 * No (though I still don't know what a tab is). But actually, thinking about it now, you might not need to call #arraymap at all. I would change that field's type from "Page" to "String" - and then, within the query's "fields=" parameter, instead of "Equipe_de_management", put in something like "CONCAT(, Equipe_de_management, )" . Yaron Koren (talk) 17:53, 4 December 2015 (UTC)

where clause on page names with special characters
Cargo doesn't seem to handle page names with special characters very well, at least when needing to use them in a where clause like: |where=._pageName=""

It gives this message: Error in "where" parameter: the string "#" cannot be used within #cargo_query.

I believe it's the same issue happening at your demo on this page. Thanks. --Kc5vcx (talk) 21:58, 9 December 2015 (UTC)


 * Sorry about that; there was a validation change I made a few months ago that led to that error. I think I just fixed it in the code. Thanks for diagnosing the problem. Yaron Koren (talk) 01:19, 10 December 2015 (UTC)


 * I got the latest Cargo code via git and see your change, unfortunately still doesn't seem to work. My page name is like 12-34 Company 'Test' and I'm still using a where query like ._pageName= --Kc5vcx (talk) 21:57, 11 December 2015 (UTC)


 * Same error message? Yaron Koren (talk) 22:13, 11 December 2015 (UTC)


 * Yes. --Kc5vcx (talk) 22:46, 11 December 2015 (UTC)


 * I found a workaround and maybe better to use .pageID field and magicword instead of full page name. --Kc5vcx (talk) 02:37, 13 December 2015 (UTC)


 * Fun with PHP. It turns out that PHP's default HTML decoding decodes everything except for single quotes. I just checked in a fix, so if you go back to using "PAGENAME" it should work now. There's nothing wrong with using "PAGEID", though. Yaron Koren (talk) 15:11, 14 December 2015 (UTC)


 * Confirmed fixed, thanks! --Kc5vcx (talk) 23:05, 14 December 2015 (UTC)

Holds not working correctly
I've got a query that uses HOLD after several other conditions in the where clause. It was working when I originally wrote it on Dec 3. Now I get an error when using HOLDS after an AND where the query shown does not have a space between the AND and the name of the value field. Adding an extra space (AND HOLDS) makes the query work. --Cody3647 (talk) 22:48, 23 December 2015 (UTC)


 * Yes - this was a bug that was introduced on Dec. 17, and fixed on Dec. 22 - you just need to update your code. Yaron Koren (talk) 23:27, 23 December 2015 (UTC)


 * I double checked and pulled from git again, but it said Cargo was up-to-date but the problem is still there.--Cody3647 (talk) 23:48, 23 December 2015 (UTC)


 * That's very odd. Can you check to see if your version of CargoSQLQuery.php contains this code? Yaron Koren (talk) 02:39, 24 December 2015 (UTC)


 * Yes the changes are there.--Cody3647 (talk) 04:41, 24 December 2015 (UTC)


 * Is this viewable on a public wiki? Now that I think about it more, I don't know how "AND HOLDS" could work within a query. Yaron Koren (talk) 05:36, 24 December 2015 (UTC)


 * Not Working Example and Working Example with the extra space. --Cody3647 (talk) 06:43, 24 December 2015 (UTC)


 * Okay, thanks for the example. (I thought you literally meant "AND HOLDS".) And sorry about that. Clearly the issue hasn't been fully fixed... Yaron Koren (talk) 14:53, 24 December 2015 (UTC)


 * I believe this is now fixed in the latest code. Yaron Koren (talk) 23:45, 25 December 2015 (UTC)

Simple Scribunto library for Cargo
I made a simple tool for processing Cargo queries in Lua: User:StasR/CargoLua. If the request specifies lua, the result of a query is available through the function. Is it possible to include this (or something similar) in the standard version? --StasR (talk) 12:14, 25 December 2015 (UTC)


 * Wow, this is great! I'll be happy to include this functionality. I wonder, though, if the name for the format, 'lua', couldn't be made more generic? After all, all the format itself really does is make the query results available as a global PHP variable. This could be used by more than just Lua - in the most basic case, Scribunto could offer support for a language other than Lua, and this format could then be used by that other language. There are also potentially other extensions that could make use of it, etc. I don't know what a good alternate name might be, though - 'in memory'? 'for code'? What do you think? Yaron Koren (talk) 03:45, 26 December 2015 (UTC)


 * Maybe 'pure'?
 * Generally, it would be interesting to pick up the result a little earlier, before converting values to strings. But my skill is not enough to understand whether and how to do it. --StasR (talk) 08:43, 26 December 2015 (UTC)


 * I could live with "pure". And there could be special handling for this format earlier on in the process, so that the values are kept as non-string values. What is an example of where that would help? Yaron Koren (talk) 16:55, 26 December 2015 (UTC)


 * I don't have a specific example. Just a lack of transformation is better than two transformations. But I'm not sure that this is necessary if it requires a lot of work. --StasR (talk) 22:15, 26 December 2015 (UTC)


 * I don't think it would take that much work, but it would be special handling, and I'd prefer if there were a clear reason to do that. Barring an example, I'll probably just add in this code as-is, other than the necessary changes to change the format name. Yaron Koren (talk) 01:18, 27 December 2015 (UTC)


 * ОК. Other options for the name of the format: 'none', 'native', 'internal', 'array'. --StasR (talk) 08:34, 27 December 2015 (UTC)


 * Hm - all of those have their own merits. Any preferences? Yaron Koren (talk) 14:54, 27 December 2015 (UTC)


 * To your taste :-). Attention: https://www.mediawiki.org/w/index.php?title=User%3AStasR%2FCargoLua&type=revision&diff=1983509&oldid=1980374 (unset($global) does not work correctly inside functions). Also should be set '$wgCargo_Lua = NULL' on an empty query result. --StasR (talk) 20:41, 27 December 2015 (UTC)


 * Alright, I added in your code, with some small modifications; I went with "native" for the format name. I can't test out the code, so please let me know if you find any issues. Yaron Koren (talk) 04:37, 12 January 2016 (UTC)


 * Many thanks! I will try it in the next few days. --StasR (talk) 16:07, 12 January 2016 (UTC)


 * It works! --StasR (talk) 10:59, 15 January 2016 (UTC)


 * That's great! Thank you for all the code. I look forward to officially releasing this. Yaron Koren (talk) 14:46, 15 January 2016 (UTC)

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)

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)

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)