[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

Rafael Lima  changed:

   What|Removed |Added

   Assignee|libreoffice-b...@lists.free |rafael.palma.l...@gmail.com
   |desktop.org |
 Status|NEW |ASSIGNED

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

--- Comment #7 from Andreas Säger  ---
OK, but the user input is not evaluated and this is confusing me. Name it
CellValue. The Boolean return value is more important.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

--- Comment #6 from Andreas Säger  ---
Created attachment 173395
  --> https://bugs.documentfoundation.org/attachment.cgi?id=173395&action=edit
Test validation formulas

Indeed, a condition is a formula expression (or two), and it is evaluated.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

--- Comment #5 from Rafael Lima  ---
It makes sense... LO does not evaluate the formula before validating cell
content.

My only concern about using "CellFormula" instead of "CellValue" is that it
would cause the same confusion in users. Maybe they'll start thinking LO should
evaluate formulas before validating the cell value.

How about we use the proposed code, but keeping CellValue to avoid confusion?

Hence, the new example would be:

Function ExampleValidity(CellValue as String, TableCell as String) as Boolean
Dim msg as string
Dim iAnswer as integer
Dim MB_FLAGS as integer
msg = "Invalid value: " & "'" & CellFormula & "'"
msg = msg & " in table: " & "'" & TableCell & "'"
msg = msg & Chr(10) & "Accept anyway?"
MB_FLAGS = MB_YESNO + MB_ICONEXCLAMATION + MB_DEFBUTTON2
iAnswer = MsgBox (msg , MB_FLAGS, "Error message")
ExampleValidity = (iAnswer = IDYES)
End Function

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

--- Comment #4 from Andreas Säger  ---
With or without macro, the validation feature evaluates the literal user input
(the formula). As far as I know, there is no way to catch formula results, no
calculation event or anything like that.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

Rafael Lima  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

--- Comment #3 from Rafael Lima  ---
Created attachment 173386
  --> https://bugs.documentfoundation.org/attachment.cgi?id=173386&action=edit
Cell Formula Example

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

--- Comment #2 from Rafael Lima  ---
Hi Andreas!

Thanks for reporting this issue. I agree with you that the example can be
improved. I also tested your code and it works.

There's just one thing I don't understand. Do you have any idea why the macro
deals with the cell formula instead of accessing the value directly? (I would
like to understand it so I can document it better)

The fact that the macro works with the cell formula leads to weird situations,
for instance (see the attached file): 
- Column A has some values
- Column C has a validity rule to accept only integer values that are <= 100;
if an error occurs, I call the macro you proposed
- Note that if the user inputs values directly, everything works as expected;
but if a formula is entered, the formula result is not validated; for example,
in cell C5 the result of the formula is 50 (which is <= 100) but still I get an
error.

So regardless of the formula result, the validation rule returns an error.
Hence, I don't know why LO implemented this feature using the cell formula.

I know that this is not related to the macro you proposed. But I think it's an
important point to address when updating the help page.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 143211] Better example macro

2021-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=143211

--- Comment #1 from Andreas Säger  ---
Created attachment 173376
  --> https://bugs.documentfoundation.org/attachment.cgi?id=173376&action=edit
Validation example based on suggested example macro

The validation in the green area accepts integers > 0. In case of failure the
validation macro asks if the value should be accepted anyway.
A red conditional format marks the entries where the validation prompt has been
answered with Yes.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs