Extension talk:Cargo

Magic Words and Fields
I'm using CONCAT in  to take one database field and construct some special wikitext before it displays. I do need to use magic words which is causing an issue I can't resolve.

As a simple test  works fine with the "r" in "Actor" converting to an "x" to make "Actox".

However, if I had add a database field it no longer works. . Role.position returns "Actor", and even with the magic word conversion, it still returns "Actor" instead of "Actox". 70.160.223.43 11:53, 12 August 2023 (UTC)


 * I would recommend doing the whole thing within SQL, i.e. using the function REPLACE instead of creating a call to #replace - that should work better, if I understand what you're trying to do correctly. Yaron Koren (talk) 13:08, 15 August 2023 (UTC)
 * You can escape curly braces by creating templates that return 🇦🇩, e.g: Template:(( that contains  and a matching Template:))  which you then call like   to get a working template Ivlvlvllvlvlvlvlvlvl (talk) 13:50, 2 September 2023 (UTC)
 * That is a really useful comment, thanks. I wish I'd thought of that years ago. Jonathan3 (talk) 22:23, 2 September 2023 (UTC)

Store a different boolean value
How to I store a different value than "Yes" or "No" in the Cargo table when using a checkbox in Page Forms? I thought adding something like to #cargo_store in the template would do it, but I still see Yes or No values: |Test= Alternatively, can a different value be stored by adding parameters to the form itself? Tahoma403 (talk) 09:25, 2 September 2023 (UTC)


 * What do you want to do? If it's to display things as "first" or "second" then you could handle that in the template displaying the infobox/query. Jonathan3 (talk) 22:19, 2 September 2023 (UTC)
 * Don't ask me why, but I actually want to reverse the stored Yes or No values, so that an unchecked box stores Yes in the Cargo table and vice versa. I'm aware that I can query the data to display different values. Tahoma403 (talk) 04:38, 3 September 2023 (UTC)
 * Why are "first" and "second" in that call? Shouldn't it be "No" and "Yes"? Yaron Koren (talk) 12:24, 6 September 2023 (UTC)
 * Sorry, I put "first" and "second" to clarify that I wanted different values stored than the standard Yes or No, but in reality I want the reversed No/Yes for the checkbox/boolean entry. Neither first|second or No|Yes seem to work. Tahoma403 (talk) 13:20, 8 September 2023 (UTC)
 * I have no idea - that seems like it should work. Yaron Koren (talk) 15:09, 8 September 2023 (UTC)
 * I figured I needed to change the field type from Boolean to String to make it work. Tahoma403 (talk) 12:06, 9 September 2023 (UTC)

Queries fail depending on the order tables are listed
Testing the staging version of a wiki that will be upgraded from MW 1.37.2 and Cargo 3.0 to MW 1.40.0 and Cargo 3.4.1, we have come across an issue on the updated site where queries that were working are now failing. The cases l've encountered happen when you are joining 3 tables: if the primary table (the one included in both join clauses) is listed last, the query that is generated looks like ... ..., which fails with a sql error. If the primary table is listed first or second, you instead get a working query: ... ... Ivlvlvllvlvlvlvlvlvl (talk) 14:07, 2 September 2023 (UTC)


 * Handling of the "join on" order was improved a lot in the latest Cargo version, 3.4.3 - I would recommend upgrading to that one. Yaron Koren (talk) 00:58, 3 September 2023 (UTC)

Compound queries overall order
Hi everyone, I'm looking to make compound queries to output in the "template" format but for my application I need an overall order option, so the output of the two queries are mixed. Currently, the output is the output of the first query, followed by the output of the second query. Is it possible to change this? Thanks Garuda3 (talk) 15:36, 2 September 2023 (UTC)


 * Until you get a better answer - I think that recently I thought about this and concluded that it wasn't possible, as there are very few possible options outside the individual queries within #compound_query. I guess that it would be possible via a Lua/Scribunto module. Jonathan3 (talk) 22:22, 2 September 2023 (UTC)

Query showing each item of "List" field on separate row
If Field_A is a Cargo list field, could you do a query ending up with a table like this?

A     | Page ---+--- abc   | Page1 def   | Page1 xyx   | Page2 Jonathan3 (talk) 21:52, 13 September 2023 (UTC)


 * Sorry for asking too soon. I worked it out with #arraymap and the template output format. Jonathan3 (talk) 22:01, 13 September 2023 (UTC)
 * You could also do this by just directly querying the "field table", i.e. the table named MainTableName__FieldName. Yaron Koren (talk) 13:06, 14 September 2023 (UTC)

Dynamic Table format issues
Testing dynamic tables format suggests there's no way to disable "hidden fields" toggles and text (, or is there? --There's no unique class around the toggle text, there is for toggle links (I can hide part, not all). To workaround, I had to warp the cargo query in a div that forced matching page background color, and a negative margin, moving the table up on top of the unwanted "hidden" fields, to actually hide them. This allows these columns to be searched/sorted-on still (say if they contained keywords, or text for images/icons I wouldn't want in the table). This isn't ideal, as there's flash of all on load.

I tried to instead move these to values under the "details fields", but are not searchable/filterable, why? Further, specifying a "hidden" (toggle column) field in "details fields" removed it from "hidden fields" to be searched on. I ended up having to double-specify the same fields twice, with different names, for them to be both searchable and folded up below in the "more information" unfoldable section (+), rather than between record contents--all of which displays initially until full page load. Is this the intended behaviour in either case? FrozenPlum (talk) 01:31, 17 September 2023 (UTC)

ToI wish DataTables maker had labelled "toggle columns" as such (to accurately describe function), and for Cargo to have an option for toggle label/link visibility, to have truly "hidden" columns (as in appearing entirely absent, but searchable), and for "details fields" sto also be searchable and function independently of non-displayed "hidden" columns. Ideally, by default all should be searchable with some mechanism provide to exclude specified field (better control over what can be filtered on, or not).

Hopefully Yaron doesn't mind that I added to the docs a couple things I found the hard way:
 * That "details fields" are not searchable (currently).
 * Only indexed fields can display in "details fields".

FrozenPlum (talk) 01:31, 17 September 2023 (UTC)