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 5304 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am using a serial plugin to receive data into a field, I need to manipulate this data so that I get the most recently received reading each time.

The data feeds into a holding field, when it populates into the field it appears as either 1 reading, 2 readings or 3 readings at a time with the newest one being the last one to appear in the field.

Each reading has a leading and ending identifier (I can't enter them here as the character set isn't supported).

The data looks like this:

3.156G 4.541G

The leading identifier, 3 spaces, THE DATA I WANT, a G and an ending identifier.

Going by the above, my end result would be "4.541"

Can anyone help me out with how I will get the data required.

I am using the Troi Serial Plugin

Posted

That wouldn't drop the 'G' off the end. Another possible option would be:

GetAsNumber ( RightWords ( field ; 1 ) )

Posted

Or Filter( RightWords( field ; 1 ) ; "01234567890." )

Posted

Or Filter( RightWords( field ; 1 ) ; "01234567890." )

Isn't there some point in using the layout pulled formatting, the dot makes hardly any point if the receiving field is number, but could make a hell of a difference if the system setting is other than "new world" default.

--sd

Posted (edited)

You could use =

GetAsNumber ( RightWords ( field ; 1 ) )

However, if you are using a comma as your decimal separator, and the input data contains a dot instead (as shown in the OP example) you already have a problem.

---

Oops - didn't see LaRetta already suggested this.

Edited by Guest
Posted

I didn't use a calculation based on the GetAsNumber( ) function because nobody said that an identifier must be a number.

What if his system has the comma as a decimal separator, but the identifier isn't a number ( only a sequenze of digit and dots ) ?

Also I didn't discard the G because he said:

"THE DATA I WANT, a G and an ending identifier." that isn't exactly the same of their next: "Going by the above, my end result would be "4.541"

Posted

... and now I remember why I didn't use RightWords ( )...

If the identifier was a decimal number starting with a dot ?

Posted

If the identifier was a decimal number starting with a dot ?

Doesn't seem very likely:

Each reading has a leading and ending identifier (I can't enter them here as the character set isn't supported).

But it would be better if the OP clarified this point.

Posted (edited)

"The leading identifier, 3 spaces, THE DATA I WANT, a G and an ending identifier."

I read that this is the description of the sequence of how the characters will appear ... the leading identifier, 3 spaces, THE DATA HE WANTS, then a G and an ending identifier.

It was clearly indicated the final result of 4.541. BTW, GetAsNumber() drops invalid characters at the beginning, middle or end since FM sees numbers only (or as indicated by Michael, a comma if the OS was so inclined). Invalid characters are not seen as word separators either.

RightWords() applied to 313.44 417.22445G would automatically drop the first invalid character because it does not see it as a character.

313.44 417.22445G would be considered two words (only because of the space between) and the calculation I provided will give the result of 417.22445. You can go on until the cows come home but we can only go by the information presented. If the person presenting the data doesn't provide all possible strings then it is their responsibility to come back and provide further detail.

Also, a period or dash does NOT belong to invalid character set as was indicated by "Each reading has a leading and ending identifier (I can't enter them here as the character set isn't supported). And sorry, Michael, my response was more directed towards Daniele but overall I was speaking to the both of you. :laugh2:

Edited by Guest
Posted

I sure misunderstood the sequence and what he considered an identifier.

So now, thanks to LaRetta, I understand that the string could be:

[LeadingIdentifier][3spaces][TheData][G][EndingIdentifier][LeadingIdentifier][3spaces][[color:red]TheDataHeWants][G][EndingIdentifier]

In this case RightWords ( string ; 1 ) may give incorrect value if:

[[color:red]TheDataHeWants] starts with a dot

[[color:red]TheDataHeWants] ends with a dot

The lone sure thing is that there are 3 spaces before the last part of the string.

So my calc could be modified to:

Let(

values = Substitute ( Trim ( YourField ) ; " " ; ¶ ) ;

Substitute ( GetValue ( values ; ValueCount ( values ) ) ; [ "G" ; "" ] ; [ "EndingIdentifier" ; "" ] )

)

This can evaluate correctly a string like:

313.44G .44G

or

313.44G 31344.G

Posted

It might be nice to hear back from the OP. He hasn't been back since he posted his question.

Lee

Posted

Thank you.

I like:

Old Patient

OutPatient

because some times the OP needs to be patient with us till he becomes old. ( or, like an OutPatient, must come many times to the Forum/Hospital ) :

This topic is 5304 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.