AnsweredAssumed Answered

Decimal seperator "weird" functioning.

Question asked by bronie12345 on Sep 24, 2012
Latest reply on Sep 25, 2012 by philmodjunk


Decimal seperator "weird" functioning.


     This has kept me busy for almost 4 hours straight now, without any progress.

     The main problem:
     When I enter a number, in a numeric field (non-filtered), everything goes allright.
     Once I enter that same value using a script, FileMaker (11 Pro Advanced, on a local DB) does not recognise the decimal seperator (although in both cases it's a period).

     I've already checked my script's output with a dialog, but until the field, everything seems ok.

     Just placing a period as text behind the first character is not an option in this case, due to the fact that the number will be somewhere between 5 and 80 000.

     Yes, I know I over-use the PHP registering, but that was due to some other bug earlier in the process.
     Both scripts are ran with full access privileges

     The scripts that places the text into the field:

     (times script, 60s interval)

          Set Variable [$t; Value:PHP_Register]
          Set Variable [$r; Value:PHP_Execute ( "$from = 'EUR';

          $to = 'USD';
          $handle = fopen($url, 'r');
          if ($handle) {
              $result = fgetcsv($handle);
          echo $result[0];" )]
          If[PatternCount ($r "Plug")]
             Show Custom Dialog ["HELP"; "The PHP plug-in is not registered!"]  //Yes, this one still occurs sometimes
             Set Veriable [$r; Value:TextReplace ( $r ; "," ; "." )]    //This was an earlier try to fix it, but did not work
             Set Field [onrelevant::EURUSD; $r]                            //Store it in a numeric global storage field
             Perform Script ["o_p_8"]                                               //This due to o_p_8 first being a Trigger Script
          End If
     Freeze Window
     Go to Layout ["onrelevant" (onrelevant)]
     Set Variable [$p; Value:onrelevant::EURUSD]
     Go to Layout [Overeenkomst"(Overeenkomst)]
     Go to Record/Request/Page [First]
        Set Field [Overeenkomst::TotaalUSD; Overeenkomst::TotaalEUR * $p]
        Go to Record/Request/Page [Next; Exit after last]
     End Loop
     Go to Layout [original layout]
     TextReplace ( text; searchString; replaceString )
          Let ([
          searchStringSplit = Substitute(searchString; "*"; ¶); 
          beginString = GetValue(searchStringSplit; 1); 
          endString = GetValue(searchStringSplit; 2); 
          lenBegin = Length(beginString);
          lenEnd = Length(endString);
          ptBegin = Position(text; beginString; 1; 1);
          ptEnd = Position(text; endString; ptBegin + lenBegin; 1) + lenEnd;
          lenAll = ptEnd - ptBegin; 
          keepText = Middle(text; ptBegin + lenBegin; lenAll - (lenBegin + lenEnd)); 
          modText = Left(text; ptBegin - 1) & Substitute(replaceString; "*"; keepText);
          remainText = Middle(text; ptEnd; 9999999)
          lenBegin > 0 and lenEnd > 0 and 
          ptBegin > 0 and ptEnd > lenEnd;
          modText & 
          TextReplace(remainText; searchString; replaceString)
           ; text))