Arcade expression to calculate unique IDs in ArcGIS Pro - attributes

Arcade expression to calculate unique ID in ArcGIS Pro
I have a field that I want to be automatically populated with a unique ID whenever a new record is created. I'm pretty rusty at working with Arcade and Attribute Rules. I've figured out how to make a number automatically populate through a sequence and attribute rule, but I don't know how to make the rule take into account the values already in the table.
Using NextSequenceValue, the rule will add an ID that is unique to the new sequence that I created, but it is not unique from the other records that already have IDs. This is an old dataset with loads of different IDs that don't necessarily follow a predictable pattern, otherwise I would just choose my sequence start appropriately (some IDs are in the 100s, some in the 1000s, some even 100,000s, etc.).
I basically want to perform a check where the rule assesses if the ID is unique and if it's not, it adds 1 or something until it is unique.
I tried using a sequence but it doesn't take into account already existing IDs so they aren't truly unique.

Related

Creating Unique identifier in Excel that links the same record on different deliveries

I need to create an unique ID that will identify each business, so I can see on each delivery if they were added, removed or updated. Some background below:
I have a client who will make deliveries of business to be mapped in CSV format
The client will every quarter deliver a new file, which probably will
not be exactly the same data, it may contain addition, removals,
updates.
I don't want to do normalization in the data, because I want to
compare each raw delivery to see what has changed from one delivery
to the other.
The files can contain thousands or just a few records
It will be difficult to create uniqueness only on field concatenation, because the record can change a lot, of just a little.
The order of the business can change during deliveries (the first one can be in the middle or in the bottom)
I think there is no way to create uniqueness, can someone help me here?
Example of data to be delivered:

MongoDB API pagination

Imagine situation when a client has feed of objects with limit 10.
When the next 10 are required it sends request with skip 10 and limit 10.
But what if there are some new objects were added (or deleted) to collection since the 1st request with offset == 0.
Then on 2nd request (with offset == 10) response may have wrong objects order.
Sorting on time of their creation does not work here, because I have some feeds which are formed on sorting via some numeric field.
You can add a time field like created_at or updated_at. It must updated when ever the document is created or modified and the field must be unique.
Then query the DB for the range of time using $gte and $lte along with a sort on this time field.
This ensures that any changes made outside the time window will not get reflected in the pagination, provided that the time field does not have duplicates. Most probably if you include microtime, duplicates wont happen.
It really depends on what you want the result to be.
If you want the original objects in their original order regardless of Delete and Add operations then you need to make a copy of the list (or at least of the order) and then page through that. Copy every Id to a new collection that doesn't change once the page has loaded and then paginate through that.
Alternatively, and perhaps more likely, what you want is to see the next 10 after the last one in the current set including any Delete or Add operations that have take place since. For this, you can use the sorted order in which you are viewing them and a filter, $gt whatever the last item was. BUT that doesn't work when there are duplicates in the field on which you are sorting. To get around that you will need to index on that field PLUS some other field which is unique per record, for example, the _id field. Now, you can take the last record in the first set and look for records that are $eq the indexed value and $gt the _id OR are simply $gt the indexed value.

Dynamic validation list in Excel

I have an issue regarding data validation in Excel, namely how to dynamically set the validation source.
I have three tables, where the first contains a product ID and a product name. The second table contains a product ID together with a serial number. A third table has three columns; one for product ID, one for serial number and a description for e.g. error reporting.
What I want to do is related to the third column where I select the product ID in a drop-down box which is linked to the first table. This works perfectly fine. The second column though, must only allow serial numbers related to the product ID selected according to the relationship in the second table. Hence, the data validation list must be dynamically generated by the input in the first column.
The reason for having it in Excel is due corporate reasons and personally I'd use an SQL-database for this very issue. E.g. if I were to use SQL-syntax to generate the validation list, the corresponding SQL-statement would be:
SELECT serialNumber WHERE productId = 12345;
I've tried using the INDEX-MATCH, but unfortunately MATCH only returns a scalar value rather than an array. I have not come across array functions prior to today, but I assume such might be included in order to accomplish this and have tried a bit without success.
If I somehow were to acquire an array returning the row numbers where there is a match, the INDEX-function would accomplish my needs, I presume.
My question is therefore, is there a method to acquire an array of matched values or can my problem be solved using a more elegant solution? If it could be of value if it can be made without VBA, also for corporate security reasons.
Thanks in advance!

Cassandra schema to find if a group exists based on an set of users as input

I am trying to define a Cassandra schema for the following use case: Each unique set of users defines a group. The query pattern requires a quick way to find if a group exists based on an set of users as input.
Since there is very little information given, I will make some best-case assumptions here. I am assuming there is a unique way of identifying a user using a fixed length N-bit hash (let's call it uid). I am also assuming that the max number of users (MAX) in a group would be such that (MAX < 64*1024*8 / n). This is because Cassandra has 64KB limit on key length). In real terms this means that if you have up to 32k users, you could form any group up to the max number of users.
Given the above, I would say that a sorted concatenation of the uids would be an easy way to identify the group and the group can be keyed as such.
In that case, a single lookup by the sorted concatenated key formed by the query set of users would give you the answer if you get a hit.
Let's say
key of G1 = u04,u08,u10,u12;
key of G2 = u01,u11,u12;
...
Key of GN = u09,uxx,uyy;
If searching whether a group containing users u04, u08, u03, exists, simply create a key "u03,u04,u08" and try and find a hit in the "Groups" column family.
If you are working with a larger user-set with larger users per group, then a different approach may be needed.
EDIT: Can you give a sense of maximum how many users may form a group. I assume your client would have to pass a list of all those users as part of he query.

How do I generate the unique number in replication copy? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to create an auto incrementing field in lotus domino?
We are generating the unique sequence number for each document like an employee ID.
But user can enroll the information in different locations.
So we replicate the database into many.
Problem is, Number is generating. But the sequence number gets duplicated when the user works on different replicas.
If you must use sequential numbers, you should have the database assign a temporary number to the document when it is created and then have only one server execute an agent that assigns permanent sequential numbers to the documents on a daily or more frequent basis.
However, most of the time people just need UNIQUE numbers assigned to the documents. Using the #Unique formula generates a unique string to identify a document. Or, you could have it assign sequential numbers that include the server name as a prefix. You could use a combination of date-time and server or user information to create a unique identifier as well.
My experience is that most of the time when people say they have a requirement for sequential numbers, they're wrong, they just need unique numbers and think that sequential is the only way to do it.

Resources