Lotus Notes - <Computed text> issue - field

I have an editable field called Number. This field value changes to "" every time a button is clicked.
So, I want to display its value using a < Computed Text > using as default value Number.
Is there any chance after the button was clicked, the < Computed Text > to display the 'old' value from the field Number?
Thanks!

Yes. You just need to store that old value somewhere before you clear it:
Field OldValue := Number;
And then retrieve it later:
Number := OldValue;
#Command([ViewRefreshFields]);

As I've understood you need to use Help Description and Field Hint in field properties instead of your combination of computed text and event handlers.

Use computed for display field with formula:
#If( #IsDocBeingLoaded; Number; #ThisValue )
That way it will show value of Number field since opening.

Related

TMaskEdit for Date curious behaviour when enter mask char

I am using a mask edit to create a TDateTime component.
I use the following mask: !99/99/0000;1;_
It works fine save that if as the user enters the date they also type the date separator, if they are on the second section (ie the month or the day depending on your locale), the cursor jumps to the year section. If you are on the year section it beeps.
I have tried capturing the dateSeparator in keydown of the component and although I intercept it and set it to 0 it nevertheless jumps from the day/month section to the year section. I even try resetting the selstart after setting the key value to 0, but it doesn't work.
Any ideas as to how to overcome this behaviour would be appreciated.
Not quite an answer to my question, but I solved the issue by using OnKeyPress instead of OnKeyDown and inserting the following code:
if (key = FormatSettings.DateSeparator) then
key := #0;

How to check whether or not a particular cell value is modified in Google Sheets

I am a beginner in Google Sheets. I want to know how I can detect a cell value is changed.
Here is what I am trying to do:
I have two columns in the Sheets, one is the 'Modified Date', one is 'Value', i.e,
Modified Date Value
---------------------------------
09/21/14 5
I want the date to be automatically updated ONLY if the value of the second column is Changed. For example, if I change '5' to '10' on Jan 1st 2015, then the date will be changed automatically to 01/01/15.
I was trying to create a custom function isModified() and assign a function like "=IF(isModified(B1), today(),)" to the first column, where isModified ideally should return true if the given cell's value is modified, false otherwise. Is there any built-in function or custom function in add-ons store that does like isModified()? If not, how can I create my own function that detects the modification of a cell's value?
Please help.
All you have to do is to implement the simple trigger onEdit(event). Following a possible solution:
function onEdit(e){
var range = e.range;
if (range.getColumn() == 2){
var previous = range.offset(0, -1,1,1);
previous.setValue(Date());
}
}
On the proposed solution, the hole date and time is written in the cell "Modified Date". I did this way to make sure the script is working fine. In the case you want just the date, you can change Date() by new Date().
Hope it is useful! If not, let me know:)

Indexing with a Date field (as a String) in ClientDataSet

on Delphi XE2,
I have a ClientDataSet which have many fields as Name, ...
It have a field named Date, as value type String. Containing a Date (dd/mm/yyyy)
I want to print content of ClientDataSet, using FastReport.
I want before to sort content ascending according to the Date field. I'm using index.
But when doing this, sorting does only sorts fields according to the content of the Date string before the "/".
form example dates like : 12/11/2012, 15/10/2012, 01/12/2012 are sorting like this : 01/12/2012 - 12/11/2012 - 15/10/2012.
ny idea how doing this correctly ?!
The sorting is correct! As you have a string field, the sorting is made like strings are sorted i.e. from left to right. If you want it sorted by Date you need either a date field or sort the string representation like yyyy/mm/dd.
You have some options:
Bring the field as a DateTime field. You would have to change the original SQL to that.
Do what Marjan suggested, bringing that string field formatted on an ISO-like style (which allows for the field to be ordered cronologically when string sorting is aplied) and creating an calculated field for user-display formatting.
Creating a new field on the TDatasetProvider's OnGetRecords event and populating it as a Date field.
Similar as above but creating a string field with the date formatted in ISO-Like style.
I personally suggest the first approach if possible.

Filemaker 10: Fill repeating fields with calculation

I have a repeating field (say size 10) in my Filemaker database and try to fill it say with the Values 1..10.
I now want to use "Auto-Enter Calculation" to fill the field:
Case(
RepField = 1; 1;
RepField = 2; 2
)
But the field does not contain any values. How do I fill the field based on a calculation?
An auto-entered calculation cannot set values in the other repetitions. You'd need to use a script trigger or a button to call a script to set the repetitions on record creation.

How to skip one column and add string to another column in listview?

We create a listview with 5 columns. In one function we add data in first 3 cols in sequence. In the second function we want to add string to the fifth col. Column 4 may be blank or filled before the second function. We just want to skip that column and add data in the fifth. Or the question may be boiled down to checking the fourth col' value. How to check it ? We tried
if listview.items[i].SubItems.Strings[2]=''..., It will prompt out of bounds.
Please give some advice on it.
Thank you in advance.
You cannot skip a column in a TListView when you use the item.SubItems property, but you can assign an empty string to a column.
you must proceed like this:
first always fill your columns when you add a new TItemList.
item:=listview.Items.Add();
item.captiom:='Data col1';
item.SubItems.Add('Data col2');
item.SubItems.Add('Data col3');
item.SubItems.Add('');//empty
item.SubItems.Add('');//empty
then in your other functions, access any column to check whether it is empty or for adding data.
if listview.Items.Item[0].SubItems[2]<>'' then //check if the fourth column of the listiew is empty
listview.Items.Item[0].SubItems[2]:='Data col4' //adding the data
To add a string to the fifth column of the first item of a listview:
ListView_SetItemText(ListView1.Handle, 0, 4, 'fifth column');
To get the string in the fifth column of the first item of a listview:
var
ItemText: array [0..259] of Char;
begin
ListView_GetItemText(ListView1.Handle, 0, 4, #ItemText, SizeOf(ItemText));
ShowMessage(ItemText);
edit: Note that this method of adding a text to a subitem bypasses some VCL mechanism, for instance you can get a 'SubItem.Count' of '0' and still have the text on the subitem. If this is important I would use RRUZ's method.

Resources