I am currently having difficulties finishing a Macro that I have developed so far. The purpose of the Macro is to modify the current 'object information'.
Here are the requiremets:
Hotspot 7 (3x used)
Multiples of the same hotspot
I have a Loop, it selects all elements based on the criteria, IF Statements proof the elements based on the number of digits and if the element isDigit() or not (some Hotspot contain a letter, eg. 7A).
How do I create the possibility to record the count for every hotspot that is used?
Once the count exists how can the macro automatically add an 'a' to the 2nd Iteration, a 'b' for the 3rd, a 'c' for the 4th and so on...
Are array's possible in Isodraw Macro Language?
I thought of creating a variable for every hotspot available...but, I have no idea if that works, where to start and I think it is impossible as all variables need to be predefined at the beginning...
Any help is greatly appreciated!
Are you simply trying to create unique IDs within the page? If so, could you simply use the built-in ID (i.e. AUTOID_34169)? This is unique per document. We've used this method for a number of years now without a problem. One caveat however is that if you simply reference the ID field the relationship can be broken if you copy/paste the content as that creates new IDs.
If this doesn't suit your needs can you expand what your end goal is?
Thanks for responding. Not quite. I need to do the opposite. I need to assign a specific ID as shown in the table in my main post.
The problem I am having is creating a macro that can identify if:
For example, we have 11 Hotspots in total. Hotspots 1-6.
Hotspots 1, 2, 3 and 5 are shown once. Hotspot 4 is shown two times and 6 three times.
Hotspots 1, 2, 3 and 5 have the following ID Name:
1 = hot0001
2 = hot0002
3 = hot0003
5 = hot0005
Hotspots 4 and 6 have the following ID Name:
4 = hot0004
4 = hot0004a
6 = hot0006
6 = hot0006a
6 = hot0006b
I already have a Loop which filters the current selection using IF Statements. I have assigned the correct ID Names the only remaining Problem is identifying the same iterations of a given hotspot and assigning a unique ID that complies with the above rule.
I hope that explains it better.
If needed, I can post a sample of the script in it's current state.
I have to apologize. From your description your end goal still appears to be that you want unique IDs (i.e. hot006, hot006a, hot006b versus three hot006). From a basic level I think you may want to think of making a temporary attribute on each object. If I'm thinking about this right you could take and duplicate your value so...
Let's take your three hotspots that I I just mentioned.
What you want though is:
If you inserted a new attribute copying the value over...
Then loop back through doing select ifs based on the temp attribute. It'd be time consuming but you could get closer. First time you grab the first and cycle through selecting all IDs that match the selected temp attribute and appending your unique ID letter (number would be easier). Second time through it would have no matches to the ID.
Not the cleanest approach perhaps but it seems that it'd get the job done.
If I'm still off, I'd suggest attaching an example and the code you have thus far.