How to get number of hits on a table

By | May 26, 2014

UNIQID is used to generate a sequence of unique long integers for each Adonix table.

New Stuff: How to conditionally restrict the import update

Syntax:

UNIQID ( class )

While UNIQID is used to have a unique number for a given table opened previously; these numbers are assigned sequentially and therefore they can be used as an access key to the file.

These numbers are kept by copy, extraction, restoration and revalidation of the table.

Warning! This number sequence does not need to be consecutive. For instance, there is no number retrieval further to a Rollback.

The result type is Integer.

Remarks

For a newly created table, numbers are assigned from number 1 and then it will be incremented sequentially. the current number is kept, if a table is reset to 0, the numbers are reassigned starting from 1. There is no other way to decrement this sequence of numbers.

The numbers assigned sequentially cannot be reassigned if a transaction is aborted by Rollback. To implement this kind of function, if all the numbers should be assigned, it is recommended to resort to counters (for instance, a main counter and a grid containing the aborted numbers to be reassigned in priority).

The uniqid instruction is executed even if the table is locked.

The uniqid instruction does not update the [S]fstat variable.

Dysfunctioning generated by the sequences of the database

There is a problem if the sequence no longer exists. ERP X3 sends an error message linked to the database. Then the database log file needs to be referred to for further details.

Since sequences are used for generating unique keys, if the uniqid function returns a value lower than the last one to be recorded, ERP X3 will display an error message of the type”Key does not exist in the table”. In that case, the sequence needs to be updated.

How to check the validity of a table sequence?

Example of the “EMPDETAIL” table of a “DEMO” folder

Uniqid-1

How can I assign the correct value back to the sequence?

# By proceeding with the process started above.
# The most simple solution is to ensure that there is only one user on this particular file

If nbruser > 1: Errbox  ‘You are not the only user of this folder!’ : End: Endif

While uniqid([EMP]) <MAXA: Wend

About Us
Greytrix – a globally recognized Premier Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation expertise.

Greytrix caters to a wide range of Sage Enterprise Management (Sage X3) offerings – a Sage Business Cloud Solution. Our unique GUMU™ integrations include Sage Enterprise Management (Sage X3) for Sage CRMSalesforce.com and Magento eCommerce along with Implementation and Technical Support worldwide for Sage Enterprise Management (Sage X3). Currently we are Sage Enterprise Management Implementation Partner in East Africa, Middles East, Australia, Asia. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit for Sage Enterprise Management to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage Enterprise Management – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage Enterprise Management – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information on Sage X3 Integration and Services, please contact us at x3@greytrix.com. We will be glad to assist you.