Jump to content

context for type ahead


imoree

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

Recommended Posts

Hello Everyone;

 

i am tyring to get a type ahead working on my system regarding point of sale. The only issue i see is taking teh user to another 

layout to use the following type ahead system:

	If ( start > WordCount ( haystack) ; 0 ; Let([     needle = LeftWords(needles; 1);     
	word = MiddleWords(haystack; start;1)     ];
	Case (     Left ( word; Length(needle) ) = needle;     
	If(         WordCount(needles) < 2; 1;         FindWordPartsInText(RightWords ( needles; WordCount(needles) -1); haystack ; 1) );
	FindWordPartsInText(needles; haystack;     start + 1)     )     ) )
	

Link to comment
Share on other sites

I've spent a few minutes trying to decipher the calculation but gave up, too early in the morning.

A couple of thoughts:

- don't next IFs in CASE in IF: declare all you need to check up front in a LET() and do just one CASE; you'll thank yourself later and you'll make it easier to get help on what the calc is supposed to do

- avoid implicit result interpreting.  You call FindWordPartsInText() in both the IF and the CASE but you don't explicitly do a check that would rmake it clear what your intent is

FindWordPartsInText( something) = true

or

FindWordPartsInText( something) = false

or

FindWordPartsInText( something) > 0 or > 1

We can sorta guess what you mean but make it explicit so that we (and your future self) don't have to guess.  Explicitly state what you are checking.

 

As to your question: can you rephrase?  Why is going to a layout important?  And what is it that does not work?  You can't take the user to another layout?  Or you can but the calculation does not give you the result you need?

Link to comment
Share on other sites

39 minutes ago, Wim Decorte said:

I've spent a few minutes trying to decipher the calculation but gave up, too early in the morning.

A couple of thoughts:

- don't next IFs in CASE in IF: declare all you need to check up front in a LET() and do just one CASE; you'll thank yourself later and you'll make it easier to get help on what the calc is supposed to do

- avoid implicit result interpreting.  You call FindWordPartsInText() in both the IF and the CASE but you don't explicitly do a check that would rmake it clear what your intent is

FindWordPartsInText( something) = true

or

FindWordPartsInText( something) = false

or

FindWordPartsInText( something) > 0 or > 1

We can sorta guess what you mean but make it explicit so that we (and your future self) don't have to guess.  Explicitly state what you are checking.

 

As to your question: can you rephrase?  Why is going to a layout important?  And what is it that does not work?  You can't take the user to another layout?  Or you can but the calculation does not give you the result you need?

the calculation gives me NO RESULT on the layout i need it for. 

Link to comment
Share on other sites

6 hours ago, Wim Decorte said:

in your example it is not clear where the values from haystack and needles come from.  Can you post a real example showing where you get the data from?

Portal Filter calculation:

 IsEmpty ( GLOBALS::g_lookUp ) or FindWordPartsInText ( GLOBALS::g_lookUp ; Customers::FullName; 1) 

Issue is if i am creating a new record: the Customers information is not stored.

Since Global searchfield is: a field in portal to trigger cf, then it does not find anything.

see file attached: layout ( work order):

 

Your Store.fmp12

Link to comment
Share on other sites

  • 2 weeks later...

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