Hi,
I'm trying to create the standard lookup functionality with code :?
ShipToCodeFilter Text variable on the RequestOptionsForm.
ClearOnLookup = NO
ValidateTableRelation = No
TextBox ShipToCodeFilter.
OnLookup(VAR Text : Text[250];) : Boolean
IF CustNoFilter = '' THEN
ERROR('You must select a customer No. if you want to filter on Ship-to Code');
ShiptoAddress.SETFILTER("Customer No.",CustNoFilter);
IF FORM.RUNMODAL(0,ShiptoAddress,ShiptoAddress.Code) = ACTION::LookupOK THEN BEGIN
IF ShipToCodeFilter <> '' THEN
ShipToCodeFilter := ShipToCodeFilter + ShiptoAddress.Code
ELSE
ShipToCodeFilter := ShiptoAddress.Code;
ShipToCodeFilter := UPPERCASE(ShipToCodeFilter);
END;
What I'm trying to do is that depending on whether the text in the textbox (where I start my lookup from) is selected, the action either overwrites the existing text (if the text was selected), or appends the newly looked up value behind the cursor.
So, if I have "Addr1.." in a textbox and do a lookup to Addr2, then my textbox should read "Addr1..Addr2" ONLY if "Value1.." was not selected (highlighted). If "Addr1.." WAS selected, my textbox should overwrite "Addr1.." with "Addr2", rather than append to it.
This is in a Financials 2.01 database.
Answer the question and wait for the answer.
Comments
If I got it right, I have solution to your problem.
I will setup the situation as ---
TextBox -- On which lookup is needed
LookupForm - Form on which lookup is made
LookupSource - source table of lookup form
GetValue -- A getter function in LookupForm that returns selected value (Address in ur case)
I Hope this helps.
Regards,
Jyotsna Sonawane
Navision Developer
You are forgetting to return a value!
Following trigger can be found on a form.
It's very important you don't fill any fields from this trigger. the only thing you can fill is the Text variable. Don't go validating triggers from this trigger. Plus the function needs to have a boolean returned to know if you found a value or pressed the cancel button.
Code have not been tested!
OOooh and do go generating errors from this trigger. This trigger should always start and finisch, return 2 variables.
If it was hard to write, it should be hard to understand."