How to hide form fields data? - PROGRESS 4GL? - openedge

Below query is giving results as expected but it fails to hide form field value when the variable lvl_select is set to Yes or No after updating the form fields.
Expected Results:
When lvl_select = Yes then update only form field lvc_part
When lvl_select = no then hide update the value of the form field lvc_part and update lvc_part1 whereas lvc_part1 then hide the value of the form field lvc_part and update lvc_part1
DEFINE VARIABLE lvl_select AS LOGICAL NO-UNDO.
DEFINE VARIABLE lvc_part AS CHARACTER NO-UNDO.
DEFINE VARIABLE lvc_part1 AS CHARACTER NO-UNDO.
DEFINE VARIABLE path AS CHARACTER NO-UNDO.
FORM
lvl_select COLON 20
lvc_part COLON 20
lvc_part1 COLON 20
path
WITH FRAME a no-labels width 80 ATTR-SPACE.
mainloop:
REPEAT:
DISPLAY
lvl_select
lvc_part
lvc_part1
path
WITH FRAME a.
UPDATE
lvl_select
WITH FRAME a.
IF lvl_select = YES THEN
DO :
UPDATE
lvc_part
WITH FRAME a.
END.
ELSE
DO:
UPDATE
lvc_part1
WITH FRAME a.
END.
END.

DISPLAY and UPDATE work with the whole frame. UPDATE doesn't hide part of a frame just because you didn't update anything.
One way to get the result that you seem to want would be to HIDE the fields you don't want to see in your logic branch. Another would be to use two different frames.
Also - ATTR-SPACE was used to reserve space on screen for certain very old terminals from the 80s that had so little memory that they needed to spaces on the screen to store the start of attributes like REVERSE and UNDERLINE. These terminals were fondly referred to as "space wasters". Nobody actually makes such a thing anymore and I very seriously doubt that you are using an emulator that needs that attribute.

To hide lvc_part in the ELSE block, write
HIDE lvc_part IN FRAME a.

Related

How to check an "empty" fill-in field which is not empty due to the format?

I have a window, containing some fill-in fields. One of them is meant to contain a date, having 99/99/9999 as a format. Due to that format, when emptying the field (selecting the content and press the DEL button), I see "__/__/____" on screen (the underscores mean spaces).
In order to check if this fill-in field is empty, currently the source code does this as follows:
IF Date_Fill-In:SCREEN-VALUE <> "/ /"
As you can see, this is heavily dependent on the format of the fill-in field.
Is there a built-in function I can use to check if the screen-value of a fill-in field is empty, without needing to check the format?
Thanks in advance
Dominique
Check for the INPUT-VALUE property returning ?.

Progress-4GL: How to dynamically add a fill-in in a form and take user input in it?

I've a form in a base QAD mfg/pro (ver 10.2) program. I know the names of form, frame and fields. I'dont have access to base program's code modification. I've a wrapper program that access various fields from the existing form using handles, first-child, next-sibling etc.
What I want to do is to add a fill-in into this form/frame from the wrapper program and during runtime, take user input into that field.
I've been able to create text (for label) and fill-in field (called user) in the frame, however, the field is in't enabled.
create fill-in txt_user
assign
name = "txt_user"
row = 7
column = 19
frame = hWidget
visible = true
side-label-handle = lbl_user.
How can I enable the fill-in field txt_user and take input in it?
To Enable the field set the SENSITIVE property to TRUE. To query the current value, read the INPUT-VALUE property.

How to filter data with hidden data?

In my klipfolio data source I have a field version-name. The data in there is numeric and alpha. I only want to see the numeric version. So I created a hidden data which will evaluate to true when the first digit is numeric (this rule is valid in my case):
IN( LEFT( #/issues/fields/fixVersions/name;, 1), ARRAY( 0, CUMULATIVE(REPEAT(1,9))))
but the hidden data does not change my output? Do I need to apply this somewhere to get the current result filtered?
If you want a hidden data slot to act as a filter, right click on the hidden data slot -> Filter... then in the Members tab, select "True". This will filter out all the records that do not have a digit as the first value in the string.

dynamodb creating a string set

I have a lot of objects with unique IDs. Every object can have several labels associated to it, like this:
123: ['a', 'hello']
456: ['dsajdaskldjs']
789: (no labels associated yet)
I'm not planning to store all objects in DynamoDB, only these sets of labels. So it would make sense to add labels like that:
find a record with (id = needed_id)
if there is one, and it has a set named label_set, add a label to this set
if there is no record with such id, or the existing record doesn't have an attribute named label_set, create a record and an attribute, and initialize the attribute with a set consisting of the label
if I used sets of numbers, I could use just ADD operation of UPDATE command. This command does exactly what I described. However, this does not work with sets of strings:
If no item matches the specified primary key:
ADD— Creates an item with supplied primary key and number (or set of numbers) for the attribute value. Not valid for a string type.
so I have to use a PUT operation with Expected set to {"label_set":{"Exists":false}}, followed (in case it fails) by an ADD operation. These are two operations, and it kinda sucks (since you pay per operation, the costs of this will be 2 times more than they could be).
This limitations seems really weird to me. Why are something what works with numbers sets would not work with string sets? Maybe I'm doing something wrong.
Using many records like (123, 'a'), (123, 'hello') instead of one record per object with a set is not a solutions: I want to get all the values from the set at once, without any scans.
I use string sets from the Java SDK the way you describe all the time and it works for me. Perhaps it has changed? I basically follow the pattern in this doc:
http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_UpdateItem.html
ADD— Only use the add action for numbers or if the target attribute is
a set (including string sets). ADD does not work if the target
attribute is a single string value or a scalar binary value. The
specified value is added to a numeric value (incrementing or
decrementing the existing numeric value) or added as an additional
value in a string set. If a set of values is specified, the values are
added to the existing set. For example if the original set is [1,2]
and supplied value is [3], then after the add operation the set is
[1,2,3], not [4,5]. An error occurs if an Add action is specified for
a set attribute and the attribute type specified does not match the
existing set type.
If you use ADD for an attribute that does not exist, the attribute and
its values are added to the item.
When your set is empty, it means the attribute isn't present. You can still ADD to it. In fact, a pattern that I've found useful is to simply ADD without even checking for the item. If it doesn't exist, it will create a new item using the specified key and create the attribute set with the value(s) I am adding. If the item exists but the attribute doesn't, it creates the attribute set and adds the value(s). If they both exist, it just adds the value(s).
The only piece that caught me up at first was that the value I had to add was a SS (String set) even if it was only one string value. From DynamoDB's perspective, you are always merging sets, even if the existing set is an empty set (missing) or the new set only contains one value.
IMO, from the way you've described your intent, you would be better off not specifying an existing condition at all. You are having to do two steps because you are enforcing two different situations but you are trying to perform the same action in both. So might as well just blindly add the label and let DynamoDB handle the rest.
Maybe you could: (pseudo code)
try:
add_with_update_item(hash_key=42, "label")
except:
element = new Element(hash_key=42, labels=["label"])
element.save()
With this graceful recovery approach, you need 1 call in the general case, 2 otherwise.
You are unable to use sets to do what you want because Dynamo Db doesn't support empty sets. I would suggest just using a string with a custom schema and building the set from that yourself.
To avoid two operations, you can add a "ConditionExpression" to your item.
For example, add this field/value to your item:
"ConditionExpression": "attribute_not_exists(RecordID) and attribute_not_exists(label_set)"
Source documentation.
Edit: I found a really good guide about how to use the conditional statements

how get item from each cell in grid

I have form with grid. I defined dataStore with 2 columns (text and checkBox). Grid.store = defined dataStore. Second column is editable (you can change selection on each checkBox). I have some button, and when I click it, I want to get info about each cell. Example if have gird:
Name1 true
Name2 false
I want get info col[0].row[0] is equal 'Name1', col[0].row[1] is equal 'Name2'.
I try iterate on dataStore but it has only value which I put them by hand. The value which was changed on grid by clicking on checkBox didn't save in dataStore.. My question is how to iterate on grid, how get info about each cell.
To iterate across a store in Ext3, you can use dataStore.each()
Supply it an anonymous function and the parameter it receives will be the current record in the store. The data in the current record can be read by using record_var.get(field_name).
So, for example:
var dataStore = myGrid.getStore();
dataStore.each(function(rec){
alert(rec.get(field1));
}

Resources