How implement Drop Down Lists in character interface? - progress-4gl

I have two tables first its candidates and second this is employee. Before when i add new employee i have to look up in candidates table and after that take candidateID and add new employee with this key. I dont know how to look up in this candidate tabel. For now i have this but this is bad solution.
set cfname label "First #"
clname label "Last #" with overlay title "Candidate Name" 1 columns row 5 column 28.
find last candidates where firstname = cfname and lastname = clname no-lock no-error .
I want scrolling them and when i press "Enter" i take this key and add in employee table.
create employee no-error.
Assign
employee.candidateid = id
employee.employeeid = next-value(employee)
hiredate = today.
I dont know how to achive this.

As pointed out: this answers the orignal title of the question "How [to] implement Drop Down Lists in character interface?"
Something to get you started (character interface isn't really my best area so there might be easier ways).
It basically comes down to the VIEW-AS option on the variable definitions as well as some frame definitions.
DEFINE VARIABLE cTest AS CHARACTER NO-UNDO VIEW-AS COMBO-BOX LABEL "Select value".
DEFINE FRAME fr1
cTest WITH SIDE-LABELS 1 COLUMN.
cTest:LIST-ITEMS IN FRAME fr1 = "One,Two,Three,Four".
UPDATE cTest WITH FRAME fr1.

Related

Select from Contacts a List of People Based on Email Label Using AppleScript

Using AppleScript, how do I get a list of all people in the Contacts application who have at least one email address with a particular label?
I tried:
set peopleToCheck to every person where ((label of its email contains strContactEmailLabelHome))
Unfortunately, it returns an empty set. This can’t be correct because
set peopleToCheck to every person where ((label of its first email contains strContactEmailLabelHome))
Returns a set of one person.
property text item delimiters : linefeed
tell application id "com.apple.AddressBook"
-- Get the label of every email of every person
get label of people's emails as text
set labels to the result's text items
-- Remove duplicate items from the list of email labels
tell (a reference to the labels)
repeat length times
if string 1 = "" then set string 1 to 0
if string 1 is not in rest of strings then set end to string 1
set string 1 to 0
end repeat
set contents to strings
end tell
labels --> List of unique labels currently in use by at least one contact
-- Choose a label to match contacts against
set [specificLabel] to choose from list of labels ¬
with title ["Search Contacts by Email Label"] ¬
with prompt ["Select one of your email labels:"] ¬
OK button name ["Search"] cancel button name ["Close"] ¬
without multiple selections allowed and empty selection allowed
-- Matches
set P to a reference to (every person ¬
whose emails's label contains ¬
the specificLabel)
-- Select the matching contacts in the application
set selection to P
return name of P
end tell
set customLabel to "customLabel"
tell application "Contacts"
return people whose label of emails contains customLabel
end tell
Or, using variable for the list:
set customLabel to "customLabel"
tell application "Contacts"
set theList to people whose label of emails contains customLabel
end tell
return theList

How to replace crosstab cell's value with a string

I have column fact, it can carry some difference values:
- Positive values - real values, need to be outputted as is
- 0 is null, output as is
- -1 - special value. Need to ouput "VAC" string in cell.
- -2 - special value. Need to output "SICK" string in cell.
I tried to do it with editing dimension, i replace it with:
case
when [BaseEmp].[FACT_VALUE] = -1 then 'VAC'
when [BaseEmp].[FACT_VALUE] = -2 then 'SICK'
else to_char([BaseEmp].[FACT_VALUE])
end
But now I see error: ORA-01722 invalid number (i think, because strings cannot be aggregated). In column properties I select "min" as aggregate function.
How to replace my special values with strings?
You don't need to change value to VAC, SICK etc.
You need to change DISPLAYED value.
Unlock the padlock in RS.
Select text in your cell
Set text source to "Report Expression"
Write expression like
CASE
WHEN cellValue() = -1 THEN 'VAC'
WHEN cellValue() = -2 THEN 'SICK'
WHEN cellValue() = 0 THEN ''
ELSE cellValue()
END
I tried thinking of a work around regarding your problem. I'm not really sure what you crosstab looks like but considering your parameters above, try creating a data item which holds your case condition for your fact.
Ex.
case
when [BaseEmp].[FACT_VALUE] = -1 then 'VAC' <--- this will produce Any Error Characters
when [BaseEmp].[FACT_VALUE] = -2 then to_char([BaseEmp].[FACT_VALUE]/0) <--- this will produce Missing Value Characters
else to_char([BaseEmp].[FACT_VALUE]) <---- as is
end
Then set the data item's Data Format to number and set the values for the properties as follows:
Kindly give this a try and hopefully it can somehow resolve you problem. Cheers!
Nikita Kuhta checkout Alexey's Baturin's answer. I think it's the appropriate approach. Just one thing if you unlock and select the text in the cell, all of the cell values will be selected and affected by the report expression. You might have several columns or other fact items in the crosstab. If that's the case, what you can do is
Unlock the Report.
Select the crosstab cell/intersection you want to change.
Set the Define Content to Yes.
Drag a Layout Calculation in the crosstab cell/intersection, then insert your case statement.
Thanks to a friend who told be about the define contents. :D

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.

Put text not repeatable in horizontal detail

I want to put a static text not repeatable in horizontal band detail of my report written with iReport.
I've created my band in this way:
Print Order: Horizontal
Columns no.: 10
But I want an effect like this:
But the only effect proposed is: repeating of header name and age together the value.
How can I resolve this?
I used iReport 5.1.0
Solved!
I want to share my solution step by step:
I've created a band detail to explode in horizontal way and I've set number of column (10)
I've added a text field "Name"
I've set the following XML properties on "Name" text field:
isPrintRepeatedValues = false
printWhenGroupChanges = "name of group container"
I've put field $F{Name} in the same column of text field "Name"
The result has been:
All value of name field are repeated and the text field has shown only once.
Have a nice day ;)

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