Extension talk:Cargo

Data in cargo table not updating after I renamed a column title
I changed the name of a column header and changed the data type from boolean to text, now when I try to add text to the new field it will not save. The new header name also disappeared from the drilldown menu... I renamed all the references to the old header in the template, am I missing somewhere else where I have to rename the old column header?


 * Did you recreate the table? And does the listing for that table look correct in its Special:CargoTables page? Yaron Koren (talk) 21:21, 13 May 2020 (UTC)

Cargo equivalent to SMW's #show?
I'm sorry if this is a stupid question or if I missed something obvious. I've been trying to make it where infoboxes on my wiki will display data from another specified page so that information that changes there will be changed on other pages automatically, something I know how to do using Semantic MediaWiki's #show function. However, I can't seem to find any information on how to do anything like that with Cargo, and I don't know if it's because it doesn't exist or because I don't know how to look for it. Does an equivalent function exist in Cargo? Where can I learn how to use it? (P.S. In case you're wondering why I would want to do this over just updating the relevant pages, it's for ranked taxonomy in an ongoing evolution game. Basically, that means information potentially relevant to hundreds of pages is expected to change semi-regularly.) Disgustedorite (talk) 00:55, 14 May 2020 (UTC)


 * There's no equivalent for #show, although #show itself is not really necessary - it's just slightly different syntax for #ask. Similarly, you can just call #cargo_query to get a specific field value for a specific page. If that seems like too complex a call to make every time, you could always create a "show" template that wraps around #cargo_query and takes in the necessary values: table name, field name and page name, or some subset of those. Yaron Koren (talk) 12:10, 14 May 2020 (UTC)

Cargo equivalent to SQL arithmetic operations between 2 or more columns?
Greetings.

Considering the following SQL query: SELECT column1 + column2 AS "add", column3 * column4 AS "multiply" FROM table1;

Is it possible to achieve such behavior in Cargo?

-- N tonio36 (talk) 03:34, 15 May 2020 (UTC)


 * I don't think so, unfortunately. If there are specific sums, products, etc. you want to display, the only way to do it may be to have the template store those as separate fields - calculating them using #expr from the ParserFunctions extension. Then it's just a matter of querying those fields. Yaron Koren (talk) 04:16, 15 May 2020 (UTC)

Title disambig text
For Cargo. I'm using this template with the following code. But when you go to special:CargoTables/Articles, the "history" column appears empty. How can I fix that? The reason is that in my personal wiki I develop fictional content and to differentiate one from another that have the same name, I add a title in brackets. --Hispano76 (talk) 19:26, 16 May 2020 (UTC)


 * Does  display what you expect (i.e. the part of the page title which is within round brackets) when it's just on its own on the page? Does plain text save to the Cargo table? Is history correctly declared in the template? Jonathan3 (talk) 20:50, 16 May 2020 (UTC)
 * when it's just on its own on the page? yes
 * Does plain text save to the Cargo table? no, is blank
 * Is history correctly declared in the template? yes
 * Greetings. --Hispano76 (talk) 21:41, 16 May 2020 (UTC)


 * Could you cut and paste here your template for the Articles table? Jonathan3 (talk) 21:47, 16 May 2020 (UTC)


 * For example (in spanish). Grettings. --Hispano76 (talk) 22:01, 16 May 2020 (UTC)

Multiple Cargo wikis from one database
Is it possible to set up one stand-alone database to store the cargo tables from multiple wikis? I was thinking of using separate prefixes per database, and it looks like it currently uses $wgDBprefix, but I have that overlapping in some wikis. Would it be possible to get $wgCargoDBprefix, or is there another option? -- Prod (talk) 22:09, 18 May 2020 (UTC)


 * Sure, it sounds possible to have multiple wikis use the same database as their Cargo database - and if each one had a different DB prefix, then you would prevent collisions. You couldn't have wikis then access each others' data, but you could query all the tables together outside of MediaWiki. Yaron Koren (talk) 13:51, 19 May 2020 (UTC)

How to query out a Cargo "Datetime" column in local time
Hi everyone, hope you're well.

I'd like to use  to pull out page creation/modification times from the fields in the   table (which I've switched on with  ) in the user's local timezone.

What I've managed to do is whitelist using the   array, and then use something like   in the Cargo query. This isn't a great solution because now I've hard-coded a time zone in the query, and my users might have a different local time zone in their preferences. What I was hoping for was a way to just default to showing DATETIME fields in the user's local time.

I see that another option might be to use, then, in the template, wrap the returned DATETIME field with the   parser function, and that may be the route I end up going in the end. I just miss the convenience of the "table" output format, because it saves a lot of work (thanks Yaron!).

What I'm wondering is whether there isn't a more Cargo-y way to do this, like something built in that I just missed.


 * It looks like what's missing is a variable like " ", which would return a value like 'America/New_York' for each user. If such a thing existed, you could pass that in to CONVERT_TZ within #cargo_query, and I think you'd get exactly the output that you're looking for. I don't believe any such variable exists. I don't know what the best approach is to create it - maybe to use the MyVariables extension, and add this additional variable to it. It'll require some PHP programming... which hopefully you can do. Yaron Koren (talk) 00:38, 25 May 2020 (UTC)

Write to Cargo tables in Lua
Cargo is amazing. Thank you! Just one issue -- Is it possible to write to Cargo tables in Lua? My module is used in the same template that defines the table. It iterates over an unlimited number of infobox-like numbered params (entry1=foo, entry2=bar, etc.) so it would be tedious to do the storage via wikitext. I think I could get away with the Lua module returning the  code along with the generated wikitext... but that seems hacky. &mdash; MusikAnimal  talk  05:39, 24 May 2020 (UTC)


 * I'm glad you're enjoying Cargo! I don't know that much about Lua programming, but I believe that, instead of passing in that wikitext (which would indeed be hacky), you should use the callParserFunction method to call #cargo_store. Eventually, I hope there will be native Lua methods for #cargo_store and #cargo_declare, like there is for #cargo_query. Yaron Koren (talk) 00:40, 25 May 2020 (UTC)
 * I do not know Lua very well either, but that's exactly what I was looking for! It's essentially the same as a native call, from a programmer standpoint. What I wanted to avoid was all that string concatentation in building the wikitext. This allows me to pass in key/value pairs, so consider it solved. I have made note of this in docs with Special:Diff/3875998. Thanks! &mdash; MusikAnimal  talk  04:47, 25 May 2020 (UTC)