Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 9:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Using Arrays with no script knowledge
PostPosted: April 4th, 2012, 10:18 am 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Hi - am aware of how arrays work from previous coding experience but never used them in Opus, and don't know any Opus Script.

Simply want to create an array of 30 numbers, then be able to compare and sort these numbers into order. Had hoped to use the coding in Opus without scripts, but seem to be unable to add a variable into the 'index number' box in Opus.

Is there any way of doing this, or some simple code that I could try?

Thanks in advance for any help.

_________________
Opus Pro. v6.0
XP hOME
Intel Core 2 Duo 6550, 2 gb Ram
iNTEGRATED graphics card


Top
 Profile Visit website  
 
 Post subject: Re: Using Arrays with no script knowledge
PostPosted: April 4th, 2012, 12:27 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi,

There's an informative and comprehensive discussion with examples of how to use standard Opus actions or OpusScript to create and populate elements of an array in the Help files:

Creating Arrays in Opus

HTH

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Using Arrays with no script knowledge
PostPosted: April 4th, 2012, 9:03 pm 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Thanks for the info - I've looked at the syntax and tried the following:

Script: example = new Array(6)

Normal Code: Set Z=0
Loop 6 times

_________________
Opus Pro. v6.0
XP hOME
Intel Core 2 Duo 6550, 2 gb Ram
iNTEGRATED graphics card


Top
 Profile Visit website  
 
 Post subject: Re: Using Arrays with no script knowledge
PostPosted: April 4th, 2012, 9:07 pm 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Thanks for the info - I've looked at the syntax and tried the following:

Script: example = new Array(6)

Normal Code: Set Z=0
Loop 6 times
Inside Loop:
Script: example[z]=z
Normal Code Add 1 to z

When I try to display the arrays on screen, I cannot select the array variable from the -Text-Insert Variable option as the variable is not shown. Further, if I put this variable into six text input boxes, they are all blank, though they should, from the code above, be set to 0, 1, 2, 3, 4, and 5

Can anyone help me to get this working, to give me some idea how I could use arrays within our publications?

Many thanks

_________________
Opus Pro. v6.0
XP hOME
Intel Core 2 Duo 6550, 2 gb Ram
iNTEGRATED graphics card


Top
 Profile Visit website  
 
 Post subject: Re: Using Arrays with no script knowledge
PostPosted: April 4th, 2012, 9:45 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Paul,

I'm not very knowledgeable about this, but took a try anyway. I'm using v8 so I think the imp that I created cannot be opened by an earlier version.

Here's what I did:

(1) In a page OnShow trigger, I created a new array variable called <arrayvar> in the Set Array Variable standard action and set index 0 to a number. Then I duplicated the Set Array Variable action twice more for a total of 3 actions, setting index 1 to a different number, and index 2 to another number yet.
(2) I set up a text box and using insert variable (right click dialog), I selected the "constant expression" and entered arrayvar[0] arrayvar[1] arrayvar[2], each on a line in the text box. The result is
<arrayvar[0]
<arrayvar[1]
<arrayvar[2]

(3) When I preview, the text box displays the 3 values that I had entered using #1 above.

Maybe the "trick" is using "constant expression" in #2. When I simply serached for the new variable to insert in the text box, it did not appear in the variables list.

Hope this helps to get you started.

Kind Regards,

_________________
Stephen


Last edited by Stephen on April 4th, 2012, 11:15 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Using Arrays with no script knowledge
PostPosted: April 4th, 2012, 11:13 pm 
Offline

Joined: May 28th, 2007, 11:39 pm
Posts: 81
Location: Wirral, UK
Opus: v7.03
OS: XP / Win 7
System: Various
Hi - can I say a really huge 'Thank you' - I've wanted to start using arrays for years and have been put off by 'script' as I don't know it, but your help has literally saved me 100's of hours of coding, and I'm massively grateful for your help - it is so appreciated.

_________________
Opus Pro. v6.0
XP hOME
Intel Core 2 Duo 6550, 2 gb Ram
iNTEGRATED graphics card


Top
 Profile Visit website  
 
 Post subject: Re: Using Arrays with no script knowledge
PostPosted: April 4th, 2012, 11:16 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Happy that it was helpful. :)

_________________
Stephen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 47 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group