im trying to get the values from a table object (10 rows) to be selections in @uiradio. I understand I need a string there with options separated by a space. I tried using text.append, however when I am appending values from the table, i get like breaks in my string and I need only one like for @uiradio.
Below is the code:
!z=2
!a=1
text my_line
my_line.clear
for !a=1 to 10
table(10,1) my_categories
%category=(my_categories(!a,1))
scalar ret=@uiedit(%category, "Enter a name for your category",20)
my_categories(!a,1)=%category
my_line.append {%category}
if ret = -1 then
stop
else
next !a
endif
show my_categories
show my_line
while my_vars(!z,1)<>""
%var=my_vars(!z,1)
!selection = 1
string categoryPrompt="Choose the category"
!result = @uidialog("Caption", "Options", "Text",%var ,"Radio", !selection, categoryPrompt, my_line)
my_vars(!z,3)=!selection
if !result = -1 then
stop
else
!z=!z+1
endif
wend
@uidialog / @uiradio
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: @uidialog / @uiradio
Your description is a little cryptic, and I can't see what you're trying to do from your program (what's my_vars?).
Perhaps what you want to do it build up the string inside your for loop? Something like:
You will then have the space delimited string, mystring, at the end which you can feed into something else.
Perhaps what you want to do it build up the string inside your for loop? Something like:
Code: Select all
mystring = ""
for !a=1 to 10
%category=(my_categories(!a,1))
scalar ret=@uiedit(%category, "Enter a name for your category",20)
mystring = mystring + " " + %category
my_categories(!a,1)=%category
my_line.append {%category}
if ret = -1 then
stop
else
next
Re: @uidialog / @uiradio
my_vars is a table. my_categories is a table too. I need user to be able to select categories to be assigned to each row of my_vars. As a result I am making the uiradio and asking user for each my_var to select category (which they define too in the first part.)
Hope this clarifies what I am trying to do.
Thanks.
Hope this clarifies what I am trying to do.
Thanks.
Re: @uidialog / @uiradio
Would it be easier to do such exercise using matrices? If yes, would you be able to give me some advice on how?
Cheers,
R
Cheers,
R
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: @uidialog / @uiradio
Did you follow my advice?
Re: @uidialog / @uiradio
Yes, thank you. Needed some small tweaks in defining variables, but below is the working code:
!z=2
String mystring
table(10,1) my_categories
mystring = ""
for !a=1 to 10
%category=(my_categories(!a,1))
scalar ret=@uiedit(%category, "Enter a name for your category",20)
mystring = mystring + " " + %category
my_categories(!a,1)=%category
if ret = -1 then
stop
else
next
endif
show mystring
while my_vars(!z,1)<>""
%var=my_vars(!z,1)
!selection = 1
string categoryPrompt="Choose the category"
!result = @uidialog("Caption", "Options", "Text",%var ,"Radio", !selection, categoryPrompt, mystring)
my_vars(!z,3)=!selection
if !result = -1 then
stop
else
!z=!z+1
endif
wend
!z=2
String mystring
table(10,1) my_categories
mystring = ""
for !a=1 to 10
%category=(my_categories(!a,1))
scalar ret=@uiedit(%category, "Enter a name for your category",20)
mystring = mystring + " " + %category
my_categories(!a,1)=%category
if ret = -1 then
stop
else
next
endif
show mystring
while my_vars(!z,1)<>""
%var=my_vars(!z,1)
!selection = 1
string categoryPrompt="Choose the category"
!result = @uidialog("Caption", "Options", "Text",%var ,"Radio", !selection, categoryPrompt, mystring)
my_vars(!z,3)=!selection
if !result = -1 then
stop
else
!z=!z+1
endif
wend
Who is online
Users browsing this forum: No registered users and 2 guests
