rob Posted September 29, 2013 Posted September 29, 2013 I have a field VALUE which I want to make singular only if it is already plural. Example: Drivers should be Driver NextOfKin should remain NextOfKin ...etc I do not understand why this does not work: Substitute ( Right ( "Drivers" ; 1 ) ; "s" ; "" ) Can someone explain to me why it does not work and what might work? Thank you. ps actually it would be the field instead of the text value "Drivers" but I should think it behaves the same for either since I can't get it to work for either.
eos Posted September 29, 2013 Posted September 29, 2013 The first parameter of Substitute () is the text in which you want to perform the substitution. So your source string is only the "s", in which you substitute the search string "s" with "", and the result is an empty string. Try Case ( Right ( myText ; 1 ) = "s" ; Left ( myText ; Length ( myText ) - 1 ) ; myText ) if in fact a trailing "s" guarantees multiplicity. 1
Rick Whitelaw Posted September 30, 2013 Posted September 30, 2013 What happens when a word ends in s but is not a plural?
rob Posted October 6, 2013 Author Posted October 6, 2013 Hi, Thank you Eos, that is what I needed and I see my mistake now. You bring up a good point, Rick. I do not see how one could possibly write a calculation which would handle it if it was Processes or some other plural which ends in s but doesn't end in consonant prior. In my situation, I make sure that these items are named such that it isn't a problem. I have drivers contracts employees rights invoices so I think I'm safe. if there is way to protect in all cases, I would love to hear it though. Thank you both for your assistance.
comment Posted October 6, 2013 Posted October 6, 2013 I do not see how one could possibly write a calculation which would handle it if it was Processes or some other plural which ends in s but doesn't end in consonant prior. There are many more exceptions than that and it's not possible to handle them all without accessing a dictionary. That's not feasible within Filemaker - but might be possible using OS-level scripting or a plugin.
Rick Whitelaw Posted October 6, 2013 Posted October 6, 2013 I was thinking along the lines of "process" or "success" which are singular but end in "s".
rob Posted October 6, 2013 Author Posted October 6, 2013 It probably would help if I indicated the purpose here. I always name my tables in plural. But in custom dialog I want to take the Source field which is the table name and show "You wish to change " & 'the single form of the source field' & $item. this will be merge variable for modal dialog and dynamic message depending upon table being edited, just now working through how it will look. In all, the calculation by Eos works on all my existing sources but you are right, Rick that I'll have to be careful. Hi Comment, this first project will be rough but I am learning a great deal by working it. I am hoping to slide by using Eos' calc but I will turn to OS scripting or plugins if needed later (I know nothing about either). I have decided to drop my indicated skill level to something more appropriate like beginner. I read your work with awe. Thank you both very much.
Recommended Posts
This topic is 4123 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 accountSign in
Already have an account? Sign in here.
Sign In Now