Topic: Auto numbering: number format 1-Folio resets every time I switch folio

Hello,

First things first, I Have just started using QET and I am loving it, it is perfect for the size of projects that I am handling and being a Linux user it is great to see good software for professional tasks!

I managed to setup the Auto-numbering and it works great for conductors. I am using a formula where I label the conductors with the folio number - index of conductor in that folio

https://qelectrotech.org/forum/misc.php?action=pun_attachment&item=3009&download=1&secure_str=7080f13

But I discovered that whenever I navigate to a different folio, the sequence counter resets itself, so when I come back to this folio and continue adding conductors, now I have repeated names.

I don't know if this is a bug, bad usage or corrupted project, but maybe someone can help me.

Cheers,

Cris.

Post's attachments

Screenshot from 2024-08-16 20-15-16.png, 18.43 kb, 1170 x 281
Screenshot from 2024-08-16 20-15-16.png 18.43 kb, 25 downloads since 2024-08-16 

Re: Auto numbering: number format 1-Folio resets every time I switch folio

Hello Chris,

Formula: %F-%sequ_1 see why: https://qelectrotech.org/forum/viewtopic.php?id=1397
https://qelectrotech.org/forum/viewtopic.php?id=1404
https://qelectrotech.org/forum/viewtopi … 152#p16152

https://download.qelectrotech.org/qet/forum_img_2/rules2.png

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: Auto numbering: number format 1-Folio resets every time I switch folio

Hello Scorpio,

Thank you very much for the answer and thank you very much for the software in general!

However, the answer is not exactly what I am after. I don't know if what I have in mind is how it should work, or this would be a feature request, but how I am trying to label the conductors is using a formula which would label them with the folio number (ideally it will be auto updated if the folio number changes) and an index number unique to that folio.

For example, conductors on folio #3 would be: 3-1, 3-2, 3-3, etc. And conductors in folio #4 would be 4-1, 4-2.4-3, etc.
This would basically require that each folio have it's own persistent variable for the current count on itself and not reset when I select another folio.

Using the formula that I posted at the beginning ( %id-%sequf_1) seems to have this logic in mind, the only issue seems to be that the sequence advances on some sort of "Volatile" variable because when I change folio, it will then reset to the value on %sequ_1, which does not get increased by the method which increases %sequf_1

If I use the formula that you suggested, The conductors show the following: "3/4 - 1". Showing the folio of the total folios, and following 1 sequence across all folios which is currently not what I am after.

Thanks again for the support.

Re: Auto numbering: number format 1-Folio resets every time I switch folio

Hello Chris and thanks for compliments,

Indeed, changing folio resets the incremental conductor's counter of the folio formula because you lose focus on it when you change folio.
It seems that the problem is very old, I can reproduce the same behaviour on old versions of QET..

Curiously, I don't remember anyone reporting this bug before. Maybe working differently. nomicons/wink


With my formula don't use %id/%total folio label name, see: https://qelectrotech.org/forum/viewtopic.php?id=2365

scorpio810 wrote:

Hi,

btw use "%id" instead  "%id/%total" in your titleblock's pages, otherwise you will see Xref like this "(folio_label/total_ off_folios)-(line number)- (column_number) etc.

So, is easy with ctrl +f in and then folio section to change "%id/%total" by "%id" in all project's.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: Auto numbering: number format 1-Folio resets every time I switch folio

If I try it with the element's  formula it works just as you want, so is the problem possible in these codes files?

https://github.com/qelectrotech/qelectr … tation.cpp
https://github.com/qelectrotech/qelectr … es/autoNum

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: Auto numbering: number format 1-Folio resets every time I switch folio

Hey Scorpio,

Sorry for the long delay, I must have missed the notification that you had responded and I got super tied up at work with a different project.

I am excited now that it seems like I am exploring obscure ways of working hahaha. I guess being kind of a hobbyist and not really knowing all the standards helps nomicons/laughing

About the bug, I am not the best coder to be honest, I understand the logic, but not great at interpreting the syntax. That being said, I think there might be something regarding the "context" in this function:

void ConductorAutoNumerotation::numerateNewConductor()
{
    if (!m_conductor) {
        return;
    }

    if (!m_diagram->conductorsAutonumName().isEmpty())
    {
        NumerotationContext context = m_diagram->project()->conductorAutoNum(
            m_diagram -> conductorsAutonumName());
        if (context.isEmpty())
            return;

        QString autoNum_name = m_diagram->project()->conductorCurrentAutoNum();
        QString formula = autonum::numerotationContextToFormula(context);

        ConductorProperties cp = m_conductor -> properties();
        cp.m_formula = formula;
        m_conductor->setProperties(cp);

        autonum::setSequential(formula,
                               m_conductor->rSequenceNum(),
                               context,
                               m_diagram,
                               autoNum_name);

        NumerotationContextCommands ncc (context, m_diagram);
        m_diagram->project()->addConductorAutoNum(autoNum_name, ncc.next());
    }

    applyText(autonum::AssignVariables::formulaToLabel(
        m_conductor->properties().m_formula,
        m_conductor->rSequenceNum(),
        m_diagram));
}

The only idea that I have is that I would assume that the context should refer to the folio, and in that context there should be a property for the current count. It might be that they end up referencing a "temporary" context, not one that persists with the folio??

Re: Auto numbering: number format 1-Folio resets every time I switch folio

Hey Cristo_87,

thanks for your review, maybe also see
https://github.com/qelectrotech/qelectr … .cpp#L1582
https://github.com/qelectrotech/qelectr … .cpp#L1492
https://github.com/qelectrotech/qelectr … .cpp#L1782

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."