[Solved] Simple incrementing counter

Discuss the database features

[Solved] Simple incrementing counter

Postby dreamquartz » Sun Apr 20, 2014 6:25 pm

Hi All,

Can't seem to find a simple auto incrementing counter.
I have a table (tblServiceCounter) [see https://forum.openoffice.org/en/forum/viewtopic.php?f=13&t=69091#p308127], where I need to auto increment a record, based on use.
Every time a Service is selected, the counter should increase with '1'.

Dream
Last edited by dreamquartz on Mon Apr 21, 2014 7:11 am, edited 2 times in total.
LO 6.x and OO 4.x on Windows 7 PRO & Ubuntu 18.04 LTS.
dreamquartz
 
Posts: 716
Joined: Mon May 30, 2011 4:02 am

Re: Simple incrementing counter

Postby Villeroy » Sun Apr 20, 2014 7:01 pm

Add the service to a table every time a service is used.
Code: Select all   Expand viewCollapse view
CREATE TABLE "tblServiceUsage"(
  "SID" INT NOT NULL,
  "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "ID" INT GENERATED BY DEFAULT AS IDENTITY,
  FOREIGN KEY ("SID") REFERENCES "tblServices"("ID")
)

This records an automatic time stamp too. All you need is a "new records only form" with one list box of services.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27386
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Simple incrementing counter

Postby dreamquartz » Mon Apr 21, 2014 5:54 am

Villeroy wrote:Add the service to a table every time a service is used.
Code: Select all   Expand viewCollapse view
CREATE TABLE "tblServiceUsage"(
  "SID" INT NOT NULL,
  "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "ID" INT GENERATED BY DEFAULT AS IDENTITY,
  FOREIGN KEY ("SID") REFERENCES "tblServices"("ID")
)

This records an automatic time stamp too. All you need is a "new records only form" with one list box of services.


Thank you Villeroy,

I will investigate.
I am, however at this point, not quite sure what you mean by: "All you need..........", but I should be able to figure that out.

Keep you posted of the progress,

Edit: figured out what you meant by: "All you need..........".

OK.
Turns out that I did not ask the right question in the 1st place.
I thought I could make it into a separate topic, but apparently that does not work.
So, I will state this topic as [SOLVED] and will continue with https://forum.openoffice.org/en/forum/viewtopic.php?f=13&t=69091 where this question originated.

So please, look at that topic to see if you can help me with the counter.

Dream.
LO 6.x and OO 4.x on Windows 7 PRO & Ubuntu 18.04 LTS.
dreamquartz
 
Posts: 716
Joined: Mon May 30, 2011 4:02 am


Return to Base

Who is online

Users browsing this forum: No registered users and 3 guests