Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

virtual function in random results Edited

I have a virtual function in random results in a confiforms tableview and when I refresh the page give me a null result and I don't wanna this, i want to give some results in a row field in my form. ???!

(row:[entry._total.randomInt(14)] OR row:([entry._total.randomInt(14)]+[entry._total.randomInt(14)]) OR row:[entry._total.randomInt(14)]*[entry._total.randomInt(14)]) AND date:1

 

1 answer

Hi

 

it looks like a question about ConfiForms (and this is a plugin for Confluence, not Jira)

 

Anyway, could you tell me what this expression is supposed to do? What do  you expect?

Hi

yes , thanks for your attention

I want to create a lottery form in confluence with confiforms and i search about it and says write virtual function to give a random result and i do that but now when i refresh the page in so many times I recieve the null results and I don't want this . you know about it ?

Here is an example of how randomInt can be used (3 variants)

https://recordit.co/ujjsS8w0ca

So, we set the max (as base and set it to 100 (for example)) and then set randomIn(1), so 1 is the minimum possible

3 variants: one via formula field, 2nd via the field definition rule and 3rd one is online calculation in the view (each time new value on refresh)

Storage format

<ac:structured-macro ac:macro-id="6be21c12-9b20-4c2f-8607-808f3996527b" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="ce6eeec2-0049-4e3c-9992-91571c93e7ba" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:parameter ac:name="presetValues">base=100</ac:parameter>
<ac:parameter ac:name="type">Embedded</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="d76ba27e-c2fc-4a8b-bfe6-3b54712a4211" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">base</ac:parameter>
<ac:parameter ac:name="fieldLabel">Base</ac:parameter>
<ac:parameter ac:name="type">numberhidden</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<p>-- 1st variant</p>
<p>
<ac:structured-macro ac:macro-id="0c8b9ddf-56ab-40ec-869c-c0f41d8ba725" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">random</ac:parameter>
<ac:parameter ac:name="fieldLabel">Random</ac:parameter>
<ac:parameter ac:name="extras">([entry.base.randomInt(1)])</ac:parameter>
<ac:parameter ac:name="type">formula</ac:parameter>
</ac:structured-macro>
</p>
<p>-- 2nd variant</p>
<p>
<ac:structured-macro ac:macro-id="e3f2ff8f-3609-43b4-8b0d-80c3c5f3dc76" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">random2</ac:parameter>
<ac:parameter ac:name="fieldLabel">Random via rule</ac:parameter>
<ac:parameter ac:name="type">number</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="5c73563c-18e8-4ccb-9c75-b69381b6165b" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="values">random2=([entry.base.randomInt(1)])</ac:parameter>
<ac:parameter ac:name="action">Set expression</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>– 3rd variant</p>
<ac:structured-macro ac:macro-id="08ab3946-411c-47c6-81fb-500ad2ed638d" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="52a91fd9-afcd-446c-a38f-33dfb39a3d8d" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">random</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="0b89d904-0b72-4340-a5a6-582772d8cd8a" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">random2</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="6b7571d9-9508-4c91-97dd-85244829c622" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="overrideLabel">Random3 online</ac:parameter>
<ac:parameter ac:name="fieldName">base.randomInt(1)</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
Like kimiya majd likes this

thank you 

it's so helpful

but my rows aren't sorted regularly and my records in my form aren't Continuous and i don't want to have a null result but now i refresh it, i give a null in many times. 

what should I do?

Probably you need to fix your configuration based on the examples I have given you earlier...

Not sure what else I can answer here....

Like kimiya majd likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Share your Confluence Cloud experience for a chance to win $500!

Take our 5-minute survey to win a $500 Visa gift card! Are you currently using Confluence Cloud? We want to hear from you! Fill out this quick survey about your Confluence Cloud experience so we ...

207 views 4 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you