Jump to content

Trimming line feeds from input in global field


This topic is 2572 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

 

I have a FileMaker file that connects to an Oracle database via ODBC to display some data.  I have a global field set up for searching out serial numbers. I had defined an auto-enter calculation that replaces the existing value in the field, using the Upper() function.  This works just fine.  However, someone discovered this morning that if they hit the Return key after entering the serial number (thus adding a newline (carriage return) into the field), they would get a different result from the database.  So, I went back and changed my calculation to

Upper (Trim(SerialSearch))

. This doesn't remove any hard-returns from the end of the input.  I have also tried the Substitute function, but this doesn't work, either.  I even tried LeftValues (SerialSearch; 1), but FM seems to consider the entire field as one value, even with the LF character in there.

 

What gives?  Any ideas?  As an alternative to calculations, is there any way to disable the Return key in an input field, so that newlines can't be entered?

 

(P.S. - What's the code to enter a pilcrow here?)

Link to comment
Share on other sites

Try

Upper ( Trim ( Substitute ( SerialSearch ; [ Char(10) ; "" ] ; [ Char(13) ; "" ] ) ) )

(P.S. - What's the code to enter a pilcrow here?)

 

Press alt-7 (assuming you have a US keyboard).

 

As an alternative to calculations, is there any way to disable the Return key in an input field, so that newlines can't be entered?

 

In the inspector, specify it as a key to go to the next field in the tab order (which may not be want you want).

  • Like 1
Link to comment
Share on other sites

Actually, after a restart of FileMaker, the calculation seems to work.  I always have trouble with this particular file, but I think it's got more to do with the Oracle database it connects to.  It has lots of oddities.

 

Thanks for the tips on the ¶ (works!) and the Return key.  Both fit the bill nicely!

Link to comment
Share on other sites

This topic is 2572 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Similar Content

    • By quattleb
      I am a foster volunteer for a kitten and cat rescue. Each foster has daily medical and health items we preform for our little wards.
      Years ago I created a simple Foster Tracking database in Filemaker 16 and now use FM 17 on Mac OS Catalina 10.15.x
      Many of these chores repeat at a regular interval so so my Foster Tracking has charts that when given a start date propagates repeating fields with the next occurrence.
      Typically foster arrive in litters of 3, 4, 5 or more kittens and all have a naming theme. I've used "Companions of Doctor Who" and "Gins of the UK" for example. This is stored in a "Name Theme" field and displayed at the top of each kitten/cat record.
      Each time I weigh or give a de-worming or flea medication to a foster group I open the FM db, do a search for the group (e.g. "Gins") in the "Name Theme" field and then I have the medical charts for that group to mark my progress.
      The complication is I often have 3 different litters in three different areas of my home. 
      What I want to do is to have 3 Global Fields - which store the 3 "Name Theme"s I am fostering at a given moment.
      Find_1 "Gins"
      Find_2 "Companions"
      Find_3 "Marx Brothers"
      -----
      Then I want to place these global fields on the main layout that my db opens to. I would define each Field Label to be a Button and have each button search for the appropriate Find_x content in the "Name Theme" field.
      -----
      I cannot figure out how to capture the value of the "Find_x" Global field and insert the value into the "Name Theme" to then Find.
      Nor do I see in the Find function a way to specify that the value comes from the Find_x field but the search itself involve this value in the "Name Theme" field.
      ----
      I feel there must be some simple scriptable way maybe involving an additional layout and a calculation but the how to escapes me.
      I would be very grateful for any help.
      thank you
      Bill qb Quattlebaum
    • By GeoSteven
      All files/tables in this discussion are fmp12 using FM 17 and both files are opened when initiating the app. "logging" is opened as the primary file and "claims" is opened as an external data source.
      I have a table called "newclaim" in "logging" which contains mailing address information including a USPS zip code. I have a table called "lu_ZipCode" in "claims". There is a relationship set between "newclaim" and "zipcode" on a field called "COID" (company ID). This field is automatically populated in both tables with "DCSI". This is an old method (used in Fm6) of establishing a simple relationship so that global fields can be used to pass parameters into scripts for zip code lookup and verification. 
      In the parent script (in "logging") I set the related field "lu_ZipCode::_gZipCode" with (for ex) "12345" with the intent of calling a subscript in "claims" then using "12345" to do the lookup. However when the subscript is called the "_gZipCode" field is empty. As a workaround I called the subscript passing the "12345" as a parameter which of course works as one may expect. After setting the parameter to a local variable in the subscript I'm able to do the lookup then populate the global fields "lu_ZipCode::_gCity" and "lu_ZipCode::_gState" while still in the "claims" file. Yep, sure enough when I go back to the parent file the global fields I just populated are empty. 
      It's worth pointing out here that prior to yesterday "zipcode" was a separate file and the methods described above worked like a charm. This effort is being put forth to consolidate this old FM6 solution with 40+ files into just a few files. I imported "zipcode" into the "claims" file then copied and modified the scripts anticipating that this would be a quick little project to get rid of one more file.
      I know there are better methods (ie JSON) to get this done and I will probably go that route. At the same time I'm left scratching my head on why this tried and true method doesn't work. Why would global fields I can populate from one side of the relationship not be populated when viewed from the other side? 
    • By RajaHashir
      Hi, I'm not sure if this is the correct place to ask this. But I have a issue. 
      Basically, I have a layout which shows an Estimate. Each Estimate layout has a related table for (main estimate, descriptive, other). Each of those related tables has their own fields with detail and pricing. I have those as portals on the Estimates main page.
      My client needs to print out an invoice that shows all the estimates from the related tables in a line item type of view. 
      I was thinking to create a table with all global fields. The script will loop through each related table and transfer that to the new global table by adding new records. Then it will loop through next related table and trasnfer those. This way all table data will be in one list. Then I will print from the new global table with list view. Afterwards, I'm assuming I will need to delete the records in the global table?
      Is that the correct way? Will creating and deleting new records in a global table be an issue with other users?
      I thought of making just one table initially to hold all estimate data, but that will not work.
      Hope this is easy to understand.
    • By steveald
      The main database I work with contains thousands of records - one for each customer we have ever worked with, and a new record is created for each new customer. And there are dozens of layouts similar to the one I am working on now - all available for, and unique to, each customer record. The portion of this layout I am working on is much like an Excel spreadsheet, with a header row of values across the top, a column of ages down the left side, and a grid of values each calculated based on the value above it and the age to the left of it. See the attached example. I make use of repeating fields for every row on the grid to avoid having to create hundreds of individual calculation fields.
      To do this, I have a repeating global field (let's call it g_Benefits) that contains a list of numbers: 10, 20, 30, ..., 100 for the example shown. The header row is another global repeating field that calculates values by multiplying the values in g_Benefits by 1,000 and displaying the results as dollar amounts. Each row below that is another repeating, but non-global, field that calculates and displays values based on the values in g_Benefits, the number displayed to the left of that row, and other variables specific to the customer in that record. So, while the header row and the Age column seen in the attached example remains the same for every record in the database, the non-bold values in the grid will differ from record to record.
      But, now I need to allow for the possibility of entering a number in a custom value field that will replace the corresponding value in g_Benefits. (10 repetitions in g_Benefits means there will be 10 custom value fields.) And the custom value must be constrained to the record it is entered in (so g_Benefits can no longer be global). If I entered 25 in the 2nd custom field in one record, g_Benefits would change to 10, 25, 30, ..., 100; while the other records (and any newly created records) would keep the original values. And 2nd column of values in this layout's grid for just this record would change based on the custom value entered.
       
      This creates two issues.
      1. I need to configure g_Benefits so it populates with the default list of values whenever a new record is created and keeps those values in all existing records.
      2. And I need to configure g_Benefits so that, if a value is entered into a custom field in one record, the corresponding cell in g_Benefits changes for only that record. 
      I've been working with the Get ( CalculationRepetitionNumber ) function, but I haven't been able to get it to populate any more than the first repeating field. Even then, I'm not sure that would allow me to replace values with custom values.
      This is all done in Form view. There are no portals involved, no scripts, no virtual lists, and no related tables.
       
      Any thoughts? Screenshot attached.

    • By Matthew F
      I'd like to know if there is a way to generate a window identifier.  
       
      My goal is to be able to open two identical windows and then have conditional formatting or calculated fields appear differently to the two windows according to selections made by the user. If I use conditional formatting based on global fields then they will be set across both Windows. 
       
       
      Addendum:
      OK. I did find this post, which talks about using a custom window title, which I've considered.  That's a little messy.
  • Who Viewed the Topic

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.