vList is Lonchar variable having 1600 record after assigning to combo-box cbo_item not displaying record - progress-4gl

Defined variable vList as Lonchar which has 1600 records and then assigned the variable vList to combo-box cbo_item data's are not getting displayed in combo-box as vList is Lonchar variable having 1600 record combo-box accepting only charater datatype limit.Is there any option to create combo-box with more than 1600 records. As we can't change the widget Combo-box we want to populate the data in combo-box widget only. Please Suggest

I agree with #jensd on his comment about UX.
But you should get around the limitation of the combo-box by not assigning to the LIST-ITEMS property but by using the ADD-FIRST or ADD-LAST methods.
But with that amount of items, it's going to be sloooowwww
DEFINE VARIABLE cb AS CHARACTER NO-UNDO VIEW-AS COMBO-BOX .
DEFINE VARIABLE i AS INTEGER NO-UNDO.
FORM cb WITH FRAME a.
DO i = 1 TO 20000:
cb:ADD-LAST ("1234567890") .
END.
MESSAGE cb:NUM-ITEMS
VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.

Having a combobox with 1600 entries is bad! You really should change input type. Make a small searchable browse or an input field with search options.
Selecting from 1600 possible entries in a dropdown is a horrible user experience.

Related

Access form / textbox default value problem

I have an access continous form:
I placed a unbound text box txt1 in the header where user enters the number of the assignment. I want all rows in the form to have the same assignement number - entered only once in the header. (Later, txt2 would be hidden).
In the form, i added a another textbox and placed default value as =[txt1].
My problem is that this text is being populated only in the second row, when i start typing in the first row.
As this:
Refreshing does not help.
Any ideas?
Thank you!
Textbox 2 does not populate because the default value is not available when record edit is initiated by input into unbound textbox 1. Code will have to set Value of textbox 2 with the textbox 1 input. So with textbox 1 AfterUpdate event:
Me.textbox2 = Me.textbox1.
Alternative is to not use unbound textbox. Instead, use AfterUpdate event of textbox 2 to set its DefaultValue property. Subsequent records will populate with that value until user enters another and the DefaultValue will be reset.

Set a text field to 2 values

I'm trying to set a text field to 2 different values
value1 *new line*
value 2
This is my current solution
set(handles.text1,'String',a);
set(handles.text1,'String',Fs);
It the textfield as Fs, completely ignoring a. How can I get it to post both values? Thank you
You can use this to format a text field to have 2 values as you have described. set(handles.text1,'String',sprintf('%-s\n%-s',a,Fs))

Crystal Reports multiple parameter screens

I am creating a report with crystal reports 2008. My report has 4 parameters that the user must input, lets say: var1, var2, var3, var4. When I open the report it brings up the prompt to enter var1, once entered the user clicks next, and it goes to a second screen to get the next parameter, and so on.
My question is, is there a way to combine all of these to one screen. When the report opens, it has 4 drop downs for the parameters instead of one at a time?
I have thought about (and tried) a parameter that accepts multiple values but could not get it to work for my purposes. I am displaying approx 6 fields related to each parameter selected. SO if var1 is entered there will be 6 additional fields displayed. If it is not selected the area remains empty. Essentially each parameter represents a column to display in the report.
If there is a way to combine the 4 parameter screens that would be great, if you think this can be done using a multi value parameter then that is all I need to know and I will keep at it.
Thank you
Probably did not go about this in the best way but it serves its purpose and thought I would share for future reference. In response to the comments above, the parameters are not linked and I was not using a sub-report.
I ended up splitting the GroupSectionHEader into 4 parts, one for each variable. The report not contained GroupSectonHeader1-5. Each parameter variable had its own section. The user could select the parameter or False from the parameter input dialog. I then used the section expert and for each Group Header in the formula box nex to Suppress (No-Drill-Down) entered isnull({#var#}) or {var#} = " " this is because my variables are strings. This way if the user chose False, the variable would be left black and this formula would pick up on that and hide that section in the final formula.
I am very new at CR so I doubt my explanation is as clear as it could be, nor the most proficient.

How to design textbox visibility expression in SSRS?

I have an RDL with a table/textbox visibility set to:
=iif(Fields!question_caption.Value = "OBJECTIVE 1",false,true)
I am trying to make this textbox display the value named "narrative" only if the question_caption record = "OBJECTIVE 1". How can I do this? Currently this textbox displays nothing with the above logic. I have the narrative field stored in a Placeholder if that makes any difference.
Here is some sample data for you:
create table #dummy_data
(
question_caption varchar(max),
narrative varchar(max)
)
insert #dummy_data values('1st week dates','week 1'),('2nd week dates','week 2'),('3rd week dates','week 3'),('OBJECTIVE 1','obj 1'),
('5th week dates','week 5')
select * from #dummy_data
I don't see anything wrong with your visibility expression. However, in your question, you're discussing two separate things as one (i.e., visibility & displaying a value in a placeholder).
The hidden property will show an object (tablix, textbox, image, chart, container, etc) if the expression returns false and will hide an object when the expression returns true. When I say hide, I mean that it will remove the object from the grid and, if all is setup properly, the surrounding objects will be shifted to fill the now empty space of the hidden object.
To display (or not) a value is an entirely different thing. To show or hide a value, you would put the following expression in the value property of the placeholder:
=IIF(Fields!question_caption.Value = "OBJECTIVE 1",Fields!narrative.Value,"")
Notice that I've set it up such that if the desired value of the question_caption field is present, it will display the value of the narrative field. Otherwise, it will return an empty string. This will maintain the layout of the report but simply display the desired value or an empty string, based on some criteria.
As for the issues you're current experiencing, I'm not sure why that would be happening. I would first check that you don't have a typo in the Objective 1 hardcoded value in your expression.
If this doesn't help, please comment and let me know some more information about your problem and I'll do my best to help.

How to update another text box while typing in access 2007 form?

I have a few text boxes which have to be filled with numeric values from 0 to 100. Below them there is another text box which stands for a total (the sum of the values from the text boxes above). How can I update the sum text box while typing in any of the other text boxes above?
If you are happy that the sum box updates after a box is updated (enter, tab or such like is pressed), then this can be done without any code. First, you will need to set the format of the textboxes to be summed to numeric, then the control source of the sum box becomes:
=Nz([text0],0)+Nz([text2],0)+Nz([text4],0)+Nz([text6],0)+Nz([text8],0) ...
Note the use of Nz, it may be possible to eliminate this by setting the default value property of the various textboxes to be summed.
A large set of controls that need to be summed in this way is often an indication of an error in the design of the database. You would normally expect this kind of thing to be a separate recordset, which could more easily be summed.
I know this is old, but Google didn't come up with much for this topic and this thread didn't really help either. I was able to figure out a very easy way to do this, so hopefully anyone else looking for this will find this helpful.
My need was for actual text as opposed to numbers, but the same applies.
To do what the OP is asking for you'll need at least 3 textboxes. 1 is the textbox you want to have updated each time you type, 2 is the textbox you will be typing in, and 3 is a hidden textbox.
Set textbox 1 to reference the value of the hidden textbox 3 in its control source:
="something in my textbox " & [textbox3]
In the OnChange event of textbox 2 right a line that will set the value of the hidden textbox 3 to the Text property of textbox 2 that you are typing in:
Private Sub textbox2_Change()
Me.textbox3.Value = Me.textbox2.Text
End Sub
Each time the value of the hidden textbox 3 gets updated, the calculation/reference in the displayed textbox 1 will be updated. No need to save caret locations or anything else mentioned in this post.
I was able to do this in Access 2007 by using the On Lost Focus event of the text box.
Just put something like this on the On Lost focus event of each text box that you want to be added , just make sure to set the default value of each text box to 0.
Me.Totals.Value = Me.Text1.Value + Me.Text2.Value + etc..
The moment you click on the next text box or anywhere as long as it loses focus, your sum will already be on the Totals box. You may add as many text boxes as you like, just include them in the code.
This is problematic due to the asinine requirement in Access that you have to set focus to text areas before you can get their value. I would recommend you change your design so that the text field is updated in response to a button click instead of on change.
If you want to go the update-on-change route, you would attach change events to each of the addend text fields. The event handlers would need to save the caret position/selection length, update the sum in the output text field, and restore the caret position. You need to save/restore the caret position because this is lost when the focus changes.
Here's an example for two text fields (txt1 and txt2). The output field is named txtOutput.
Private Sub txt1_Change()
Dim caret_position As Variant
caret_position = Array(txt1.SelStart, txt1.SelLength)
UpdateSum
txt1.SetFocus
txt1.SelStart = caret_position(0)
txt1.SelLength = caret_position(1)
End Sub
Private Sub txt2_Change()
Dim caret_position As Variant
caret_position = Array(txt2.SelStart, txt2.SelLength)
UpdateSum
txt2.SetFocus
txt2.SelStart = caret_position(0)
txt2.SelLength = caret_position(1)
End Sub
Private Sub UpdateSum()
Dim sum As Variant
sum = CDec(0)
txt1.SetFocus
If IsNumeric(txt1.Text) Then
sum = sum + CDec(txt1.Text)
End If
txt2.SetFocus
If IsNumeric(txt2.Text) Then
sum = sum + CDec(txt2.Text)
End If
txtOutput.SetFocus
txtOutput.Text = sum
End Sub