I need my title to be called a key, the problem is that it can cause problems with duplicate keywords, how can I check if it exists and add -1 to the end, if so, or add -2 to the end, if - 1 exists.
keyName = "hello"
duplicates = Entry.get_by_key_name(keyName)
if duplicates:
keyName = keyName+("-1")
How to run a loop with the addition of 1 until I find a unique name?
any help much appreciated j
source
share