Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:44:51+00:00 2026-06-17T19:44:51+00:00

Within a BPM web application, I have a field for an invoice # on

  • 0

Within a BPM web application, I have a field for an invoice # on a particular page but I need for it to be auto generated every time a user attaches an invoice and views that page. That number must be unique and preferably auto-incremented. A value for the invoice # field can be displayed by querying from a table from an external MYSQL database. So every time a user lands on that particular page, a SELECT query statement can be fired.

On MYSQL end, how would I set this up? So basically, I would like to setup a query for that invoice # field where it will for run a query for example,
SELECT invoice_num FROM invoice_generator

and every time this query runs, it would return the next incremented number.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:44:52+00:00Added an answer on June 17, 2026 at 7:44 pm

    You can use mysql trigger concept here….
    I have added one example here…
    It will be very usefull for u (see this link also :http://www.freemindsystems.com/mysql-triggers-a-practical-example/)

    CREATE TABLE `products` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(50) NOT NULL DEFAULT '',
      `price` int(20) NOT NULL DEFAULT '0',
      `other` varchar(50) DEFAULT NULL,
      PRIMARY KEY (`id`),
      KEY `products_name_idx` (`name`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    
    CREATE TABLE `freetags` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `tag` varchar(50) NOT NULL DEFAULT '',
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    
    
    CREATE TABLE `freetagged_objects` (
      `tag_id` int(20) NOT NULL DEFAULT '0',
      `object_id` int(20) NOT NULL DEFAULT '0',
      `tagged_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      `module` varchar(50) NOT NULL DEFAULT '',
      PRIMARY KEY (`tag_id`, `object_id`),
      KEY `freetagged_objects_tag_id_object_id_idx` (`tag_id`, `object_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8
    

    INSERT_PRODUCTS_TAGS

    DELIMITER ||
    DROP TRIGGER IF EXISTS insert_products_tags;
    ||
    DELIMITER @@
    CREATE TRIGGER insert_products_tags AFTER INSERT ON products
      FOR EACH ROW
      BEGIN
        DECLARE current_id integer;
        DECLARE tag_id integer;
        DECLARE next integer;
        DECLARE tag_field varchar(255);
        DECLARE next_sep integer;
        DECLARE current_tag varchar(255);
        DECLARE right_tag varchar(255);
    
        -- We use the field other as comma-separated tag_field
        SET tag_field = NEW.other;
    
        -- Check for empty tags
        IF (CHAR_LENGTH(tag_field) <> 0) THEN
            -- Loop until no more ocurrencies
           set next = 1;
           WHILE next = 1 DO
             -- Find possition of the next ","
             SELECT INSTR(tag_field, ',') INTO next_sep;
             IF (next_sep > 0) THEN
                SELECT SUBSTR(tag_field, 1, next_sep - 1) INTO current_tag;
                SELECT SUBSTR(tag_field, next_sep + 1, CHAR_LENGTH(tag_field)) INTO right_tag;
                set tag_field = right_tag;
             ELSE
               set next = 0;
               set current_tag = tag_field;
             END IF;
    
             -- Drop spaces between comas
             SELECT TRIM(current_tag) INTO current_tag;
    
             -- Insert the tag if not already present
             IF (NOT EXISTS (SELECT tag FROM freetags WHERE tag = current_tag)) THEN
               -- Insert the tag
               INSERT INTO freetags (tag) values (current_tag);
               SELECT LAST_INSERT_ID() INTO tag_id;
             ELSE
               -- Or get the id
               SELECT id FROM freetags WHERE tag = current_tag INTO tag_id;
             END IF;
    
             -- Link the object tagged with the tag
             INSERT INTO freetagged_objects
               (tag_id, object_id, module)
                values
               (tag_id, NEW.id, 'products');
           END WHILE;
        END IF;
      END;
    @@
    

    Now If you execute an insert on products table:

    INSERT INTO PRODUCTS 
        (name, price, other) 
        values
        ("product1", 2, "tag1, tag2,tag3 , tag 4");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within my application I would like to show a web page within a view
This pertains within a BPM application called ProcessMaker but the logic and syntax should
I am evaluating BPM offerings to be used within our application. I wanted to
Within my scenario, I have a button within an iframe section of my page
Within my daily work, I have got to maximize a particular function making use
Within my web application I want to access my database in two different ways.
Within a Web Service CarService, I have a class called Car. Car has a
Within my application I would like to have a dialog box or a form
Within the BPM application ProcessMaker, I am trying to copy rows out of one
Within Symphony CMS, I want to be able to have an XML document which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.