<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Hi,  I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/discussions/f/rules/6943/hi-i-want-to-use-apply-function-over-generateuuid-so-i-am-taking-an</link><description>Hi, I want to use Apply function over generateuuid, so I am taking an expression like given below: =apply(fn!generateuuid, {ri!test}) here ri!test is a text array. But when I am running this rule, I am getting the below error: Expression evaluation error</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27785?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 02:10:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7dbb29c6-41f8-408e-bfd0-b9478dec0778</guid><dc:creator>Eliot Gerson</dc:creator><description>Yes, the intent is for it to be an implementation of version 4.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27784?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 02:04:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ec56d790-0be5-4dde-befb-e762be03c47c</guid><dc:creator>PhilB</dc:creator><description>@Eliot Whilst your suggestion produces a result that is extremely unlikely to be duplicated, I still don't believe it should be considered a UUID. I haven't looked at how fn!generateuuid() works, but most (older, to be fair) UUID generators that I've seen use some combination of time and machine MAC address to produce the identifiers; there's even a standard (https://en.wikipedia.org/wiki/Universally_unique_identifier#RFC_4122_Variant) for it.&lt;br /&gt;&lt;br /&gt;On balance, your suggestion could be considered an implementation of version 4 of RFC 4122, but it might be worth refining it to match the expected format of "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27781?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 01:52:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7c003c31-e6fb-4697-aa6f-88386f5ebf78</guid><dc:creator>PhilB</dc:creator><description>I&amp;#39;d still like to know what these UUIDs are to be used for; if they are for database IDs then UUIDs are almost certainly unnecessary.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27780?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 01:52:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:eefd5262-7f7c-4a6c-92ef-9cef462320d9</guid><dc:creator>Chris</dc:creator><description>Actually I take that back, running within an apply() call does in fact return different results.  Fairly speedy as well (5 ms vs 48 ms in MSSQL).   apply(rule!test_generateUuid,enumerate(500))&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27779?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 01:38:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:42cbd50b-4eef-445c-ada4-5ba3b00cff56</guid><dc:creator>Chris</dc:creator><description>Thanks Eliot, however when I run repeat() or apply() on a rule containing your code it returns the same result, 500 times - same issue as seen earlier in this thread with fn!generateuuid().  Do you see different results?&lt;br /&gt;&lt;br /&gt;I like the SQL method as NEWID() is guaranteed to be unique (RFC4122 compliant), but that is probably overkill for 99% of scenarios.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27777?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 01:19:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:129d093b-2bb5-42f4-8d6d-fa9c4b464bbc</guid><dc:creator>Eliot Gerson</dc:creator><description>Actually, you don&amp;#39;t need a string as long as the one generated by the second expression. You can modify it to fn!join(fn!dec2hex(fn!toint(fn!random(16)*256),2)), which also makes it even faster. This would be the approach that I would recommend.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27775?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 01:11:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:395fd67c-ee94-4437-a614-0d34bbaeac0e</guid><dc:creator>Eliot Gerson</dc:creator><description>There&amp;#39;s also fn!join(fn!dec2hex(fn!toint(fn!random(32)*256),2)) , which actually has a slight edge in speed over the expression I posted above. Both expressions can be used with apply().&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27772?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 00:51:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:edfa3d89-17d4-4242-8a00-294942cf3892</guid><dc:creator>Eliot Gerson</dc:creator><description>There are many ways to generate UUIDs in Appian without custom functions. And a database call can end up being costly and unnecessary. Personally, I&amp;#39;m partial to the below expression when I want to generate a UUID. Though, again, it is worth considering whether a UUID is actually needed. UUIDs tend to be overused in general (not specific to Appian) because they are so easy to generate, but in many cases, it&amp;#39;s overkill and you end up using a very long string where a much shorter one would have sufficed. &lt;br /&gt;&lt;br /&gt;left(&lt;br /&gt;concat(&lt;br /&gt;dec2hex(split(random(), &amp;quot;.&amp;quot;)[2]),&lt;br /&gt;dec2hex(split(random(), &amp;quot;.&amp;quot;)[2]),&lt;br /&gt;dec2hex(split(random(), &amp;quot;.&amp;quot;)[2]),&lt;br /&gt;dec2hex(split(random(), &amp;quot;.&amp;quot;)[2]),&lt;br /&gt;dec2hex(split(random(), &amp;quot;.&amp;quot;)[2]),&lt;br /&gt;dec2hex(split(random(), &amp;quot;.&amp;quot;)[2]),&lt;br /&gt;dec2hex(split(random(), &amp;quot;.&amp;quot;)[2])),&lt;br /&gt;32)&lt;br /&gt;&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27759?ContentTypeID=1</link><pubDate>Sat, 13 Feb 2016 00:07:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:38fcb8f7-190b-4367-b3c4-fd79223d024b</guid><dc:creator>Chris</dc:creator><description>There was definitely a limitation - I was seeing values cut off after 216 UUIDs or so (4000 might be Oracle vs MSSQL?).  This new code (with the same SP above) will split the count and apply over the SP to return the full result set - I get all 500 back in 48 milliseconds with 3 SP calls, 200, 200 100.  I just added the 500 (total) and 200 (count/each) as local parameters in the interface, this could definitely be expanded upon to be more dynamic if necessary - the max per run may also depend on MSSQL vs Oracle vs MySQL limitations, etc.&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/testGenerateUuid.zip"&gt;testGenerateUuid.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27750?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 23:48:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9f2b9f25-225f-495e-a68a-ff75d3103e26</guid><dc:creator>narasimhaadityac</dc:creator><description>I am not sure on quite sure, but it appears STUFF has a limitation of returning only 4000 characters, so ideally the above method of using SP will work for 4000 / ( 32 + 1) ~ 121 values.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27742?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 23:08:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:815cfd71-075a-47d1-96ca-41cfad1be086</guid><dc:creator>Chris</dc:creator><description>However I did note some data truncation when run in larger quantities, probably best to run in a few separate batches of &amp;lt; 200 or so.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27741?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 23:06:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:85d502f8-5de4-4ffa-85ce-d7d8bbcbf01a</guid><dc:creator>Chris</dc:creator><description>SP code did not attach, re-adding here.&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/usp_5F00_GenerateUUID.sql"&gt;usp_GenerateUUID.sql&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27740?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 23:05:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2228630a-9715-47a6-85ba-0ee95bb10dbf</guid><dc:creator>Chris</dc:creator><description>To expand on the DB approach, you can also make use of the execute stored procedure plugin function to generate UUIDs directly in SAIL forms or script tasks, node outputs, etc.  Example code attached (MSSQL).  For performance, this method only takes 20 milliseconds to generate 500 UUIDs in our environment. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/INF_5F00_generateUuid.SAIL"&gt;INF_generateUuid.SAIL&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/7345.INF_5F00_generateUuid.SAIL"&gt;INF_generateUuid.SAIL&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27738?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 21:54:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2f070adc-bac2-435b-bfbc-915acc2be303</guid><dc:creator>PhilB</dc:creator><description>@Angad Whilst it's true that UUID functionality will often make use of time in some aspect of identifier generation, "some reference to the time at the millisecond" absolutely does not guarantee uniqueness. Introducing functions such as rand() will decrease the changes of two identifiers being the same, but till does not guarantee uniqueness - and such advice is, quite frankly, extremely misleading.&lt;br /&gt;&lt;br /&gt;Using a database select of UUID() as suggested above might be a better way - though it may still require a looped call as in the MNI suggestion above.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27737?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 21:44:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f882e8d3-ce40-47d5-8d0a-1f7f4cfe51ff</guid><dc:creator>narasimhaadityac</dc:creator><description>@Rishub, try this alternative if it works for you. use a query database and use the below query:&lt;br /&gt;SELECT  SYS_GUID()  A FROM DUAL D CONNECT BY LEVEL &lt; 500&lt;br /&gt;&lt;br /&gt;if you want you can parameter 500 as a parameter, this guarantees unique values without MNI in this case.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27736?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 21:38:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0b0a1edd-e9dd-40d9-afa3-5fb5d2f5c105</guid><dc:creator>Angad Walia</dc:creator><description>There are a few different ways to create GUIDs not using the plugin function. Ideally you should make some reference to the time at the millisecond in order to ensure uniqueness. Here are some examples of functions:&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;datetext(now(),&amp;quot;yyyyMMddHHmmssSS&amp;quot;)&amp;amp;ri!objectID&lt;br /&gt;&lt;br /&gt;datetext(now(),&amp;quot;yyyyMMddHHmmssSS&amp;quot;)&amp;amp;text(rand()*999,&amp;quot;000&amp;quot;)&lt;br /&gt;&lt;br /&gt;dec2hex(datetext(now(),&amp;quot;yyyy&amp;quot;))&amp;amp;&lt;br /&gt;dec2hex(datetext(now(),&amp;quot;MMdd&amp;quot;))&amp;amp;&lt;br /&gt;dec2hex(datetext(now(),&amp;quot;HHmm&amp;quot;))&amp;amp;&lt;br /&gt;dec2hex(datetext(now(),&amp;quot;ssSS&amp;quot;))&amp;amp;&lt;br /&gt;dec2hex(text(rand()*999,&amp;quot;000&amp;quot;))&lt;br /&gt;&lt;br /&gt;Utilizing these would allow you to use a function like apply rather than resorting to intensive MNI&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27732?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 20:24:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:af2b44a6-a310-4e9a-b4c1-0716304ccc18</guid><dc:creator>PhilB</dc:creator><description>I think you may be stuck with using an MNI for that particular function. At a guess, I&amp;#39;d say that the behaviour you&amp;#39;re seeing is caused by the expression evaluating simultaneously rather than sequentially - so you get all the same uuids.&lt;br /&gt;&lt;br /&gt;What exactly are you using the uuids for? Can you use something other than a uuid in this instance?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27731?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 20:14:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2115e308-d30d-4789-8023-f9cc4d106657</guid><dc:creator>rishub356</dc:creator><description>hey Sikhivahans, The issue is that I don&amp;#39;t want to use MNI. We may have the number values upto 500. MNI can be a costly expression for us in terms of time, it would take.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27730?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 20:04:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fe804b7a-4c7f-43c4-9e07-f204a67738e9</guid><dc:creator>sikhivahans</dc:creator><description>@rishub I confirm from my testing results that fn!generateuuid() is generating duplicate values when repeat() and apply() (I have wrapped the fn!generateuuid() in an expression rule and has applied apply() over it.) are used over it.&lt;br /&gt;&lt;br /&gt;At the same time what I have noticed is, fn!generateuuid() is generating distinct values when the node in the process is MNIed. So if possible, try looking at possibility of implementing MNI to get the distinct values when fn!generateuuid() needs to be invoked multiple times. To the best of my knowledge and as per my observation, the function is expecting a fresh or new context every time to generate a distinct value.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27724?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 19:03:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:89d91f07-120f-4e98-8f78-c0ccf370def6</guid><dc:creator>rishub356</dc:creator><description>hey Phil, repeat function is generating duplicate values. Not unique value every time.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27722?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 18:51:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9dcecb28-7319-4635-9fea-34c556245c89</guid><dc:creator>PhilB</dc:creator><description>Additionally, if ri!test is an array, it&amp;#39;s unnecessary to wrap it in curly braces as that will result in an array with a single entry that is also an array.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hi,&lt;br /&gt;&lt;br /&gt;I want to use Apply function over generateuuid, so I am taking an</title><link>https://community.appian.com/thread/27721?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2016 18:50:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d978140f-0220-4c8e-be47-ca8e263d7b76</guid><dc:creator>PhilB</dc:creator><description>Does fn!generateuuid() take any parameters? If not, you might want to use fn!repeat() rather than fn!apply().&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>