Difference between revisions of "Text Tips"

From FM Plugin Wikipedia
Jump to: navigation, search
(Compare dataVect Text Value)
Line 59: Line 59:
 
=Example Text Functions=
 
=Example Text Functions=
  
==Compare dataVect Text Value==
+
===Compare dataVect Text Value===
 
I have found the following function useful for easy compare of a dataVect against a pre-defined text field. [[dataVectCompare]]
 
I have found the following function useful for easy compare of a dataVect against a pre-defined text field. [[dataVectCompare]]
 
bool DataVectCompare(const fmx::DataVect& dataVect, long index, char * compare )
 
//takes the passed DataVect and compares it against the fixed string passed, returns TRUE is they are the same.  (Not case sensitive)
 
// eg.  DataVectCompare(dataVect, 0,  "something")  returns  TRUE is dataVect.AtAsText(0) ==  "something"
 
{
 
fmx::TextAutoPtr dv;
 
dv->SetText( dataVect.AtAsText(index) ); // get the contents of the specified parameter.
 
dv->Lowercase(); // and convert to all 'lowercase' for checking.
 
 
fmx::TextAutoPtr    cs;
 
cs->Assign(compare); // take the passed 'Compare' string
 
cs->Lowercase(); // and convert to all Lowercase for checking.
 
 
return ( *dv == *cs );
 
 
} // DataVectCompare
 
 
 
Then, in any script where you want to compare the text passed by the user, you can include...
 
 
if ( DataVectCompare(dataVect,0, "Text") )
 
{
 
// Do something only if first parameter (index = 0) passed is equal to  'Text'
 
}
 

Revision as of 23:55, 11 July 2007


This page is about editing text passed from FileMaker to your plugin.

Text Pubic Functions





Example Text Functions

Compare dataVect Text Value

I have found the following function useful for easy compare of a dataVect against a pre-defined text field. dataVectCompare