char field defined Numeric

Author: mail@gandg.it (TheAleph)

Gooood mooooorning Uniface !! Today I fall from clouds when a user call and says "Why can I write chars in a number field, and when store got error ?" I say "No, in number fields you can't insert chars ....." ,  "Yes I do" is the answer. So I check and he's right. If the field is widget "Editbox"  it's possible,  if widget is Unifield not. I missed something? Thanks, Roberto.

6 Comments

  1. There are a lot of things which work only in unifields. One of them is ignoring keystrokes which do not belong to the syntax while you type, but UPC is applied.


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. If you define a field as DataType Numeric with Field Interface C16 (No Field Syntax, No Field Layout) with an Unifield widget, typing aaa into you get this error while typing: 3016 - Numeric field:only {0-9 . , + -} are allowed. If you define a field as DataType Numeric with Field Interface C16 (No Field Syntax, No Field Layout) with an EditBox widget, typing aaa into you get this error when exiting: 0123 - Error on field: YOURFIELD; illegal format for numeric field The user remains on the field and store cannot be executed via keyboard; if your user is really able to store probably you have somewhere an application error. To somehow mimic Unifields behaviour in EditBoxes you need to: Activating OnEdit Extended Trigger based on need: $fieldproperties(YOURFIELD) = "OnEdit=True" (please consider also EditDelay to give user a quick answer!) Extended Trigger content for YOURFIELD: trigger onEdit     variables         string    myLastChar         string    myValue     endvariables     if ($fieldinfo($fieldname, "DATATYPE") = "Numeric" | $fieldinfo($fieldname, "DATATYPE") = "Float")         myValue = @$fieldname         myLastChar = myValue[$length(myValue)]         if (myLastChar != '#' & myLastChar != "." & myLastChar != "," & myLastChar != "+" & myLastChar != "-")             @$fieldname = myValue[1, $length(myValue)-1]             message $text(3016)             return(-1)         endif     endif end In this piece of code everything could be refined if $fieldinfo(YOURFIELD, "SYNTAX") should properly return compiled string syntaxes like DIG or NUM as well as ENT(FormatString) but as of 9.6.07.X704 does not do it... Probably a bug... EmbarassedEmbarassedEmbarassed I will dig it...WinkWinkWink


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  3. gianni said In this piece of code everything could be refined if $fieldinfo(YOURFIELD, "SYNTAX") should properly return compiled string syntaxes like DIG or NUM as well as ENT(FormatString) but as of 9.6.07.X704 does not do it... Probably a bug... EmbarassedEmbarassedEmbarassed

    $fieldinfo(Field, "SYNTAX") will only return the dynamic syntax attributes (NDI, NED, NPR, HID and DIM) that have been set declaratively (in the Repository). The mentioned function is not intended for static syntax attributes, like e.g. DIG, NUM or ENT(syntax code).


    Author: diseli (daniel.iseli@uniface.com)
  4. gianni said   if $fieldinfo(YOURFIELD, "SYNTAX") should properly return compiled string syntaxes like DIG or NUM as well as ENT(FormatString)  

    Hi Gianni, with the help of the ADDITIONAL menu, we implemented a 2-phase compile (just another dITo project: DUR = dITo Uniface Reflection). After the first compile, we run a cleanup to delete orphan definitions. Between the 2 compiles, UCxx and UXxx records are scanned and whatever is important will be delivered as #defines in an included proc named as the component in library DUR_COMPONENT.. The second compile then makes use of the (updated) information. Greetings from a sunny Frankfurt/Germany, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  5. @diseli: OK, it was already clearified with support. I've opened a wish on $fieldinfo() improvements. @uli: Good point! Another good way to properly use "Additional Menu"... are you going to put together a new "Utilities" workspace starting from U9.7 frontend? Your concept is definitively more general and could be explored/used in many different instances/contexts. I'll take care about it talking with iUnifacers (i is for Italy!). Do you have any documentation about "whatever is important"? Thanks to both of you! Gianni #ioStoConVale Sandigliano


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  6. In my personal opinion this is a big beetlejuice, not wish. In next days I'm looking for your suggestions, thanks to Gianni, Ulrich and Daniel. Roberto #ioStoConVale    100% 


    Author: TheAleph (mail@gandg.it)