Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(DataFlex) Generate Monotonic ULIDs

See more ULID/UUID Examples

Generate a sequence of monotonic ULIDs all using the same seed time. This code sample generates a series of ULIDs with continuously increasing values.

Important: Chilkat's ULID functionality was introduced in v9.5.0.94.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoSeedDt
    Boolean iSuccess
    Boolean iUtc
    String sUlid
    Variant vSbUlid
    Handle hoSbUlid
    Integer i
    String sTemp1

    Get Create (RefClass(cComCkDateTime)) To hoSeedDt
    If (Not(IsComObjectCreated(hoSeedDt))) Begin
        Send CreateComObject of hoSeedDt
    End

    // You can set the seed time to any desired value.
    // In this example, the seed time is set to the current system date/time.
    Get ComSetFromCurrentSystemTime Of hoSeedDt To iSuccess

    // Generate the 1st ULID in the series.
    // (i.e. the current UTC UNIX-time)
    Move True To iUtc
    Get ComUlidGenerate Of hoSeedDt iUtc To sUlid
    Showln sUlid

    // Store the ULID in a Chilkat StringBuilder to generate the series.
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbUlid
    If (Not(IsComObjectCreated(hoSbUlid))) Begin
        Send CreateComObject of hoSbUlid
    End
    Get ComAppend Of hoSbUlid sUlid To iSuccess

    Move 0 To i
    While (i < 50)
        Get pvComObject of hoSbUlid to vSbUlid
        Get ComUlidIncrement Of hoSeedDt vSbUlid To iSuccess
        Get ComGetAsString Of hoSbUlid To sTemp1
        Showln sTemp1
        Move (i + 1) To i
    Loop

    // Sample output:

    // 01GRGH30H8DMQ4F9A0XCTZHPGM
    // 01GRGH30H8DMQ4F9A0XCTZHPGN
    // 01GRGH30H8DMQ4F9A0XCTZHPGP
    // 01GRGH30H8DMQ4F9A0XCTZHPGQ
    // 01GRGH30H8DMQ4F9A0XCTZHPGR
    // 01GRGH30H8DMQ4F9A0XCTZHPGS
    // 01GRGH30H8DMQ4F9A0XCTZHPGT
    // 01GRGH30H8DMQ4F9A0XCTZHPGV
    // 01GRGH30H8DMQ4F9A0XCTZHPGW
    // 01GRGH30H8DMQ4F9A0XCTZHPGX
    // 01GRGH30H8DMQ4F9A0XCTZHPGY
    // 01GRGH30H8DMQ4F9A0XCTZHPGZ
    // 01GRGH30H8DMQ4F9A0XCTZHPH0
    // 01GRGH30H8DMQ4F9A0XCTZHPH1
    // 01GRGH30H8DMQ4F9A0XCTZHPH2
    // 01GRGH30H8DMQ4F9A0XCTZHPH3
    // 01GRGH30H8DMQ4F9A0XCTZHPH4
    // 01GRGH30H8DMQ4F9A0XCTZHPH5
    // 01GRGH30H8DMQ4F9A0XCTZHPH6
    // 01GRGH30H8DMQ4F9A0XCTZHPH7
    // 01GRGH30H8DMQ4F9A0XCTZHPH8
    // 01GRGH30H8DMQ4F9A0XCTZHPH9
    // 01GRGH30H8DMQ4F9A0XCTZHPHA
    // 01GRGH30H8DMQ4F9A0XCTZHPHB
    // 01GRGH30H8DMQ4F9A0XCTZHPHC
    // 01GRGH30H8DMQ4F9A0XCTZHPHD
    // 01GRGH30H8DMQ4F9A0XCTZHPHE
    // 01GRGH30H8DMQ4F9A0XCTZHPHF
    // 01GRGH30H8DMQ4F9A0XCTZHPHG
    // 01GRGH30H8DMQ4F9A0XCTZHPHH
    // 01GRGH30H8DMQ4F9A0XCTZHPHJ
    // 01GRGH30H8DMQ4F9A0XCTZHPHK
    // 01GRGH30H8DMQ4F9A0XCTZHPHM
    // 01GRGH30H8DMQ4F9A0XCTZHPHN
    // 01GRGH30H8DMQ4F9A0XCTZHPHP
    // 01GRGH30H8DMQ4F9A0XCTZHPHQ
    // 01GRGH30H8DMQ4F9A0XCTZHPHR
    // 01GRGH30H8DMQ4F9A0XCTZHPHS
    // 01GRGH30H8DMQ4F9A0XCTZHPHT
    // 01GRGH30H8DMQ4F9A0XCTZHPHV
    // 01GRGH30H8DMQ4F9A0XCTZHPHW
    // 01GRGH30H8DMQ4F9A0XCTZHPHX
    // 01GRGH30H8DMQ4F9A0XCTZHPHY
    // 01GRGH30H8DMQ4F9A0XCTZHPHZ
    // 01GRGH30H8DMQ4F9A0XCTZHPJ0
    // 01GRGH30H8DMQ4F9A0XCTZHPJ1
    // 01GRGH30H8DMQ4F9A0XCTZHPJ2
    // 01GRGH30H8DMQ4F9A0XCTZHPJ3
    // 01GRGH30H8DMQ4F9A0XCTZHPJ4
    // 01GRGH30H8DMQ4F9A0XCTZHPJ5
    // 01GRGH30H8DMQ4F9A0XCTZHPJ6


End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.