Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

I may be asking this in the wrong place since it pertains to the printed page instead of a GUI layout. Please forgive me if I have.

 

My question has to do with text parsing. I would like to have to individual city names to print without the comma or state name or airport code.

 

In other words, show only the words to the left of the comma. Please see the attached image.

 

The formula I am using to get the text block is;

 

List
(
TextStyleAdd (  Origin_1&" to "& Destination_1 & " -- " &Left ( DayName ( Date_1 ); 3) & ", " &Left ( MonthName ( Date_1 ); 3) & " " & Day ( Date_1 ); Bold);
Airline_1 & If (not IsEmpty ( Flight_1 ); " #" & Flight_1; "" )&If (not IsEmpty ( Departure_1 ); "          Departs; " & Departure_1; "")& If (not IsEmpty ( Arrival_1); "      Arrives: "&Arrival_1; "");
If (not IsEmpty ( LayoverLocation_1 ); "                               Layover in " & RightWords ( LayoverLocation_1; 1) & " for " & Hour ( Layover_1) & "h" & Minute ( Layover_1) & "m";"")
)

 

Thank you in advance for any advice given.

By the way, you guys are amazing. I can only hope to be half as good as some of you are.

post-102845-0-21570600-1385826650_thumb.

Posted (edited)

Automatic message

This topic has been moved from "Eye Candy" to "Calculation Engine (Define Fields)".

 

An attachment of text would have been easier for us to work with and I’m confused by your description as to what you have now and what the result should be.

 

i.e.

Los Angles, CA

Denver, CO

 

or 

 

Los Angles CA LAX mon xxxxx Nov 11 Denver CO  ?

 

I removed my suggested link, as it didn’t match your requested need as I understood it.

Edited by Lee Smith
Edited
Posted

Sorry Lee. I should have been more concise.

 

I am wanting the first line of text to read as follows;

Los Angeles to Denver -- Mon, Nov 11. and not Los Angeles, CA (LAX) to Denver, CO (DEN) -- Mon, Nov 11.

 

I am wanting to lose everything to the right of the comma including the comma (ie: , CA (LAX)).

Posted

If we can assume there is always a From and a To and we can assume that 'to' separates them then you can try this:

Let ( 
string = Substitute ( table::Field ; [ "," ; ¶ ] ; [ " to " ; ¶ ] ; [ "--" ; ¶ ] ) 
;
GetValue ( string ; 1 ) & " to " & 
GetValue ( string ; 3 ) & " --" &
GetValue ( string ; 5 ) &
GetValue ( string ; 6 )
)

Now that's lazy of me!  It must be residual from the turkey!

 

Edited:  Removed an unnecessary space

Posted

I gather that your airport data fields (Origin_1, Destination_1, etc.) contain City, State, and Airport Code, but you just want to list the City.  Is that correct?   If so, then I'm guessing that you want to extract the text left of the comma in that data field. 

 

Left (Airport, Position ( Airport ; "," ; 1 ; 1 ) -1 )

 

You could wrap this step around each airport field in your calculation.  Alternatively, since you're on FM Pro Advanced, you could create a custom function to do the same, and then use this to make your calculation a bit more concise. 

Posted

I am wanting the first line of text to read as follows;

Los Angeles to Denver -- Mon, Nov 11. and not Los Angeles, CA (LAX) to Denver, CO (DEN) -- Mon, Nov 11.

 

 

LOL, I was giving you a way to parse this:

 

Los Angeles, CA (LAX) to Denver, CO (DEN) -- Mon, Nov 11.

 

to this:

 

Los Angeles to Denver -- Mon, Nov 11.

Posted (edited)

Hi LaRetta,

 

After all of my teeth pulling, I guess we still didn’t understand the need. :sad:

 

@ProTour

 

LaRetta’s calculation does what you asked.

 

AND:

If not,  than you didn’t present an accurate copy of the text, which can be different when you are copying stuff from a site

Edited by Lee Smith
Corrected a typo and added AND:
Posted

I confess that I only read the final post by ProTour and responded accordingly in quite a hurry ... not my usual technique of due diligence.  When I came home and read the entire thread, I realised I was off.  :shocked:

Posted

ProtTour:  Now if I can just figure out how you came up with this...

 

 

It was sort of a guess based on your complicated List formula and the output that you gave.  I really wasn't sure what was the contents of your Airport data fields.  On a related note, it might help clarify complicated calculations like that by breaking them into several components.  If its part of a script then you might use several variables to build up towards the final output. That might make troubleshooting or future changes easier.  I also mentioned the use of custom functions for the same reason. 

 

In regards to parsing text, it is common to require that some sort of data be extracted out of a larger string.   The Left, Right, and Middle functions are useful to this end, if you are able to identify a definite start and finish point for the substring of interest.  In your case the comma serves as a handy delimiter, marking the end of the City name.   

 

Position ( Airport ; "," ; 1 ; 1 ) gives the position of the comma. 

Left (Airport, x - 1 ) gives everything left of the comma (where x is the comma position, as above)

Posted

Okay, first off, thanks to everyone for your advise and input.

 

@ Lee - I honestly thought I was giving you everything you needed. Contained in the original post was the List calculation that gave me the printed result shown in the top pane of the attachment. What I wanted to do was to have a printed result as was shown in the bottom pane (which was a PDF document with the unwanted parts edited out). I admit I wasn't clear on this. My wife was screaming at me to get off the computer and 'do something useful'. I thought I was doing something useful.

@ LaRetta - Your example was great except something else I forgot to mention. There are fields for up to 10 flight entries. the way I see it as the way yours was written, If I didn't use all 10 flight entries and for example only used two flights (outbound and returning), the printout was going to have the word 'to' and the symbol '--' in flights 3-10 therefore prohibiting the sliding/reducing action to work properly.
Since I am very particular about the way my printouts look and since parts and portals don't resize correctly, I try to use calculation fields for my printing there for allowing me to only use the body part without a header. The footer usually contains the page number.

 

Therefore using Matthew's example was what worked best for me.

 

Once again, thanks to everyone for your response and advise.

Charlie

Posted

No Problem Charlie,

 

I wanted to ensure that we had an accurate picture of the raw data and a clearer understanding of what you wanted as a result of the parse calculation. In fact, I started to supple a calculation for just the Los Angles portion, but after I reread your original post, it seemed like you wanted something along the lines of what LaRetta provided.  

 

 

 

Los Angeles to Denver -- Mon, Nov 11. and not Los Angeles, CA (LAX) to Denver, CO (DEN) -- Mon, Nov 11

 

Lee

This topic is 4065 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
×
×
  • Create New...

Important Information

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