Mailing List Archive

[Cargo] How to avoid duplicate records?
I keep getting duplicate (or partial duplicate) records. How can I avoid
this?

<!-- Cargo Table -->
{{#cargo_declare:
_table = 5eMonster
|Sort_Text = String
|Page_Name = Page (unique)
|Monster_Name = String
...
}}

<!-- Store Data-->
{{#cargo_store:
_table = 5eMonster
|where= Page_Name = {{FULLPAGENAME}}
|Sort_Text = {{#if: {{{sorttext|}}}|{{{sorttext}}}|{{PAGENAME}}}}
|Page_Name = {{FULLPAGENAME}}
|Monster_Name = {{{name|}}}
...
}}

-Thanks in advance,
Brian



_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Re: [Cargo] How to avoid duplicate records? [ In reply to ]
Hi Brian,

There are some strange aspects to those calls: the #cargo_store call should
not have a "where" parameter (you may be confusing between #cargo_store and
#cargo_query). Also there's no need for a "Page_Name" field, because every
Cargo table will already have an automatic "_pageName" field, which should
hold the data you need. It could be that one or another of those issues are
somehow causing this duplication problem. If getting rid of those doesn't
fix the problem - I would make sure you're using the very latest Cargo
code, because there was just a fix to a duplication issue a few weeks ago.
And if that doesn't work either - what do you mean by a "partial duplicate"
record?

-Yaron

On Sat, Mar 7, 2020 at 1:36 PM Bri <dev@rlyehable.com> wrote:

> I keep getting duplicate (or partial duplicate) records. How can I avoid
> this?
>
> <!-- Cargo Table -->
> {{#cargo_declare:
> _table = 5eMonster
> |Sort_Text = String
> |Page_Name = Page (unique)
> |Monster_Name = String
> ...
> }}
>
> <!-- Store Data-->
> {{#cargo_store:
> _table = 5eMonster
> |where= Page_Name = {{FULLPAGENAME}}
> |Sort_Text = {{#if: {{{sorttext|}}}|{{{sorttext}}}|{{PAGENAME}}}}
> |Page_Name = {{FULLPAGENAME}}
> |Monster_Name = {{{name|}}}
> ...
> }}
>
> -Thanks in advance,
> Brian
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


--
WikiWorks · MediaWiki Consulting · http://wikiworks.com
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Re: [Cargo] How to avoid duplicate records? [ In reply to ]
Thank you Yaron. I will try what you suggest.

By partial duplicate, I mean that one record would have most of the
fields filled out and another one with the same _pageName would have
most of the fields empty with only one or two fields filled.

Part of the issue is that I was accessing the table from multiple
templates. I.e. template A would call templates B & C. Each template
would fill some of the fields of the table record. This created multiple
records with the same _pageName. I was wanting each template to update
the same record. I have started to work around this by having templates
B & C return text or a list of text and template A put the record into
the database. The drawback to this method is that I have to call
templates B & C twice (once to display the info and a second time to
return the string to be placed in the record by template A). This
creates unneeded overhead.

I'm sorry if I explained my issue poorly. If you have a better
solution/work-arround, please let me know.

-Brian

On 2020-03-08 21:47, Yaron Koren wrote:
> Hi Brian,
>
> There are some strange aspects to those calls: the #cargo_store call should
> not have a "where" parameter (you may be confusing between #cargo_store and
> #cargo_query). Also there's no need for a "Page_Name" field, because every
> Cargo table will already have an automatic "_pageName" field, which should
> hold the data you need. It could be that one or another of those issues are
> somehow causing this duplication problem. If getting rid of those doesn't
> fix the problem - I would make sure you're using the very latest Cargo
> code, because there was just a fix to a duplication issue a few weeks ago.
> And if that doesn't work either - what do you mean by a "partial duplicate"
> record?
>
> -Yaron
>
> On Sat, Mar 7, 2020 at 1:36 PM Bri <dev@rlyehable.com> wrote:
>
>> I keep getting duplicate (or partial duplicate) records. How can I avoid
>> this?
>>
>> <!-- Cargo Table -->
>> {{#cargo_declare:
>> _table = 5eMonster
>> |Sort_Text = String
>> |Page_Name = Page (unique)
>> |Monster_Name = String
>> ...
>> }}
>>
>> <!-- Store Data-->
>> {{#cargo_store:
>> _table = 5eMonster
>> |where= Page_Name = {{FULLPAGENAME}}
>> |Sort_Text = {{#if: {{{sorttext|}}}|{{{sorttext}}}|{{PAGENAME}}}}
>> |Page_Name = {{FULLPAGENAME}}
>> |Monster_Name = {{{name|}}}
>> ...
>> }}
>>
>> -Thanks in advance,
>> Brian
>>
>>
>>
>> _______________________________________________
>> MediaWiki-l mailing list
>> To unsubscribe, go to:
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>
>




_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Re: [Cargo] How to avoid duplicate records? [ In reply to ]
Hi Brian,

Okay, now it makes more sense - I think your unusual setup is what is
causing the problem. A simpler setup would definitely be better: each
template should be responsible for declaring and storing its own table.
Displaying the data together should be done by joining the tables,
presumably joining on _pageName or _pageID. (It's not even clear to me that
you need more than one template per page, but I don't know the data
structure.)

-Yaron

On Wed, Mar 11, 2020 at 2:51 PM Bri <dev@rlyehable.com> wrote:

> Thank you Yaron. I will try what you suggest.
>
> By partial duplicate, I mean that one record would have most of the
> fields filled out and another one with the same _pageName would have
> most of the fields empty with only one or two fields filled.
>
> Part of the issue is that I was accessing the table from multiple
> templates. I.e. template A would call templates B & C. Each template
> would fill some of the fields of the table record. This created multiple
> records with the same _pageName. I was wanting each template to update
> the same record. I have started to work around this by having templates
> B & C return text or a list of text and template A put the record into
> the database. The drawback to this method is that I have to call
> templates B & C twice (once to display the info and a second time to
> return the string to be placed in the record by template A). This
> creates unneeded overhead.
>
> I'm sorry if I explained my issue poorly. If you have a better
> solution/work-arround, please let me know.
>
> -Brian
>
> On 2020-03-08 21:47, Yaron Koren wrote:
> > Hi Brian,
> >
> > There are some strange aspects to those calls: the #cargo_store call
> should
> > not have a "where" parameter (you may be confusing between #cargo_store
> and
> > #cargo_query). Also there's no need for a "Page_Name" field, because
> every
> > Cargo table will already have an automatic "_pageName" field, which
> should
> > hold the data you need. It could be that one or another of those issues
> are
> > somehow causing this duplication problem. If getting rid of those doesn't
> > fix the problem - I would make sure you're using the very latest Cargo
> > code, because there was just a fix to a duplication issue a few weeks
> ago.
> > And if that doesn't work either - what do you mean by a "partial
> duplicate"
> > record?
> >
> > -Yaron
> >
> > On Sat, Mar 7, 2020 at 1:36 PM Bri <dev@rlyehable.com> wrote:
> >
> >> I keep getting duplicate (or partial duplicate) records. How can I avoid
> >> this?
> >>
> >> <!-- Cargo Table -->
> >> {{#cargo_declare:
> >> _table = 5eMonster
> >> |Sort_Text = String
> >> |Page_Name = Page (unique)
> >> |Monster_Name = String
> >> ...
> >> }}
> >>
> >> <!-- Store Data-->
> >> {{#cargo_store:
> >> _table = 5eMonster
> >> |where= Page_Name = {{FULLPAGENAME}}
> >> |Sort_Text = {{#if: {{{sorttext|}}}|{{{sorttext}}}|{{PAGENAME}}}}
> >> |Page_Name = {{FULLPAGENAME}}
> >> |Monster_Name = {{{name|}}}
> >> ...
> >> }}
> >>
> >> -Thanks in advance,
> >> Brian
> >>
> >>
> >>
> >> _______________________________________________
> >> MediaWiki-l mailing list
> >> To unsubscribe, go to:
> >> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >>
> >
>
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


--
WikiWorks · MediaWiki Consulting · http://wikiworks.com
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l