Formatted search in contacts
On the Business Partner I have created several fields that I would like to automatically update with data from a Sales Person Region table we have created.
The concept is in the Sales Rep # field(U_SalesRep) I have a query that presents the table and the user selects the number by clicking on it. This part is working as planned.
Where I am struggling is trying to use that value to get the name from the same table.
Here is the query that I built.
SELECT T0.[U_BPName] FROM @SLS_PERSON_REGION WHERE $[$U_SalesRep.0.0] = T0.[U_SlsPerNum]
Any help would be appreciated.
Thanks
Gordon
I realized I needed to use the OCPR table and not OCRD. Everything is now working
Here is what it looks like now.
SELECT T0.U_BPName FROM [dbo].[@SLS_PERSON_REGION] T0
WHERE T0.U_SlsPerNum = $[OCpr.U_SalesRepno]
I also changed the UDF to be alphanumeric.
I was not sure how I would to write the cast or convert query.
Thanks for all your help.
Similar Messages
-
Formatted Search screen - populate multiple fields
I have an Employee Id field in my screen.
On clicking Choose button,I use a Formatted Search screen to populate value to that field.
I also have other fields like employee Name,department which should be populated, once an employee Id is chosen from Formatted Search screen.
The functionality is like that of "Purchase Order screen".
Once a vendor Id is chosen Name,Contact Person etc get populated in "Purchase Order screen".
How do I do that?
Should I trap the Choose button event of Formatted Search screen?
Please help.I think all you are missing is a check to make sure you don't try and re-run the lookup when you are validating the return value from a previous lookup.
I made a minor change to my code and achieved the behaviour you described. I have extracted the relevant code from the application . Unfortunately it looses its indentation when I post it, so it might be quite hard to read. It uses recordsets for the validation as in practice most of the real validation is more complex than this cut-down sample.
This particular example is from a screen with a Customer Code prompt, and displays the customers name below it.
Regards,
John.
<b>Constant holding menu uid of Formatted Search</b>
Public Const AZU_MNU_SEARCH As Long = 7425
<b>Declare a variable at module level</b>
Dim mblnCardLookup as Boolean
<b>Create validation routine (cut down sample included)</b>
Sub ValidateCustomer(sboApp As SAPbouiCOM.Application, sboCompany As SAbobsCOM.Company, BubbleEvent As Boolean)
On Error GoTo ErrorHandler
Const AZU_PROCEDURENAME As String = "ValidateCustomer"
Dim sboRecordset As SAPbobsCOM.Recordset
Dim sboForm As SAPbouiCOM.Form
Dim sboDSCard As SAPbouiCOM.UserDataSource
Dim sboDSName As SAPbouiCOM.UserDataSource
Set sboForm = sboApp.Forms(strUID)
Set sboDSCard = sboForm.DataSources.UserDataSources("UCARD")
Set sboDSName = sboForm.DataSources.UserDataSources("UNAME")
If sboDSCard.value <> "" Then
Set sboRecordset = sboCompany.GetBusinessObject(BoRecordset)
sboRecordset.DoQuery "Select CardCode, CardName, Currency From OCRD where CardCode Like '" & sboDSCard.value & "%'"
If sboRecordset.RecordCount < 1 Then
If sboDSName.value <> "" Then
sboDSName.value = ""
sboForm.Items("edtName").Update
End If
If Not mblnCardLookup Then
LookupCustomer sboApp
End If
BubbleEvent = False
Exit Sub
End If
sboRecordset.MoveFirst
sboDSCard.value = sboRecordset.Fields(0).value
sboDSName.value = sboRecordset.Fields(1).value
mstrCurrency = sboRecordset.Fields(2).value
sboForm.Items("edtName").Update
Else
sboDSName.value = ""
sboForm.Items("edtName").Update
BubbleEvent = False
End If
Set sboDSName = Nothing
Set sboDSCard = Nothing
Set sboForm = Nothing
Set sboRecordset = Nothing
Exit Sub
ErrorHandler:
Call AZU_STD_ERROR_MSGBOX(AZU_MODULENAME, AZU_PROCEDURENAME)
End Sub
<b>Create lookup routine (cut down sample included)</b>
Private Sub LookupCustomer(sboApp As SAPbouiCOM.Application)
On Error GoTo ErrorHandler
Const AZU_PROCEDURENAME As String = "LookupCustomer"
Dim sboForm As SAPbouiCOM.Form
Set sboForm = sboApp.Forms(strUID)
mblnCardLookup = True
sboApp.ActivateMenuItem AZU_MNU_SEARCH
Set sboForm = Nothing
Exit Sub
ErrorHandler:
Call AZU_STD_ERROR_MSGBOX(AZU_MODULENAME, AZU_PROCEDURENAME)
End Sub
<b>Add the following code to the ITEMEVENT handler</b>
'Validate Customer Code
If pVal.EventType = et_VALIDATE And pVal.ItemUID = "edtCard" And pVal.Before_Action = False Then
Call ValidateCustomer(sboApp, sboCompany, BubbleEvent)
End If
'Customer Code Lookup on TAB Key
If pVal.EventType = et_KEY_DOWN And pVal.ItemUID = "edtCard" And pVal.Before_Action = True And pVal.CharPressed = 9 Then
Set sboDSCard = sboApp.Forms(strUID).DataSources.UserDataSources("UCARD")
If sboDSCard.value = "" Then
LookupCustomer sboApp
BubbleEvent = False
End If
End If
'Force Validation on Return from Lookup
If pVal.EventType = et_FORM_ACTIVATE And mblnCardLookup = True Then
sboApp.Forms(strUID).Items("edtRef").Click
mblnCardLookup = False
End If -
Formatted Search for Sales Order
Hi,
I setup a formatted search in Sales Order unit price field.
Condition required:
If Sales Order is copied from Sales Quotation, unit price remains as per Sales Quotation unit price, else formula to calculate mininum selling price appllies.
Here's the query:
DECLARE @BASE_ENTRY INT
DECLARE @PRICE NUMERIC(19,6)
SET @BASE_ENTRY = ISNULL($[$38.45.0],0)
SET @PRICE = $[$38.14.0]
IF @BASE_ENTRY = 0
BEGIN
SELECT T0.[AvgPrice]*(1+T0.[U_SPFactor])
FROM OITM T0
WHERE T0.[ItemCode]=$[$38.1.0]
END
ELSE
BEGIN
SELECT @PRICE
END
l have no issue if the Sales Order copied from Sales Quotation, however when enter the Sales Order manually the formatted search having error message:
1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Error converting data type nvarchar to numeric.
FMS execution failed on field '' with query name 'Get Minimum Selling Price (SO)'
Looks like my query has error...Hi ,
Try this below query and let me know your feedback,
DECLARE @BASE_ENTRY INT
DECLARE @PRICE NUMERIC(19,6)
SET @BASE_ENTRY = ISNULL($[$38.45.0],0)
SET @PRICE = $[$38.14.Number]
IF @BASE_ENTRY = 0
BEGIN
SELECT T0.[AvgPrice]*(1+T0.[U_SPFactor])
FROM OITM T0
WHERE T0.[ItemCode]=$[$38.1.0]
END
ELSE
BEGIN
SELECT @PRICE
END -
Help needed for Formatted Search
Hai Experts,
would like to ask you some clarification on Formatted Search. In the
query I found $http://$44.2.1 given in the criteria part.
In some articles it was mentioned that, the 44 meant for the table
connected with the form and 2 is field index and so on.
Can you please explain how to find out those numbers and field index.
I need to work out planty of FMS to fetch data into
UDF automatically based on user input.
Regards
AnandHi Anand,
You may check these threads first:
Re: Vendor default GL FMS help
Re: Runtime data calculation
Thanks,
Gordon -
Formatted Search - Restrict to Only One Customer on Activity Window
Hello Experts:
Am trying to create a formatted search to provide a suggested RMA Number on the Business Partners > Activity window in a UDF.
While in Activity, the user should get a list of ONLY the one customer they are currently working with. So if C0001 is being used in the Activity window, the list should show all suggested RMA numbers just for that customer of C0001, not any other customer.
When I use the following it shows all customers.
--FMS 6BP Automated RMA Number
SELECT
T1.[CardCode] + ' - ' + ltrim(str(T0.[ClgCode]))
FROM OCLG T0
INNER JOIN OCRD T1
ON T0.CardCode = T1.CardCode
ORDER BY
T1.CardCode Desc,
T1.[CardCode] + ' - ' + ltrim(str(T0.[ClgCode])) Desc
When I put in WHERE T1.CardCode = $[$ 9.0.0 ] in the right place it shows nothing...
Any ideas on how to make only the one current customer in Activity window appear in the list???
Thanks in Advance - ZalThanks Istvan and Gordon...
Istvan - that is the same as my SQL - just do not know how to show the $[$... correctly in this forum - it always goes to that http thing.
Gordon - tried to use your SQL but it gave me an error of "Internal Error (-1003) Occured [Message 131-183] every time I tried to click on the magnifying glass. However, due to your last line in the SQL it gave me an idea that eventually they were OK with - namely, the highest number to the top of T0.ClgCode...
Thanks again guys - Zal -
Formatted Search for Delivery Date field in SO not working
Hi All
Can anyone help me as to why my formatted search is not working?
I am currently using SAP B1A SP01 Patch 19.
I have created a user query as follows:
SELECT $ [$10.0.DATE] + 5
When I add this to the delivery field within the Sales Order and bring through the saved query which I set to auto refresh when the Posting Date field changes and to Display Saved Values it doesn't work.
Any ideas?
Thanks and best wishes
GailHI Gail,
If I am not mistaken you want to add days to the posting date...if that is so then try this out:
SELECT $[ORDR.DocDate.DATE]+5 From ORDR T0 For Browse
Set The indicator to Auto Refresh when the fields change
Nagesh -
Hi all,
In Dunning Wizard, step 5, I want to make a formated search to select only some documents. The Query I need is complicated so I tried to do Select ' ' or Select 'N' or Select 'Y' in all this examples when I do "Shift F2" nothing happens. Even with auto Refresh nothing happens. Perhaps Formated Searchs dont work on CheckBox Fields.
How can I solve this?
Any help will be apreciated.
Best regards,
José Silva
Edited by: José Silva on Jul 16, 2010 12:45 PMHI SILVA,
plz paste ur query ...
then we update in query.
Thanks,
JRAJPUT -
How to club 2 queries in one formatted search query
Hi All,
I have inserted a formatted search in the stock transfer for chnaging the 'From warehouse' based on series.
I have written following query for same,
SELECT $[$18.1.0]='08' WHERE $[OWTR.series] ='46'
It is working Fine
I want ot use same concept for selecting other based on other warehouse
e.g
SELECT $[$23.5.1]='02' WHERE $[OWTR.series] ='45'
But I am not able to club these queries on one formatted search query can anybody help to group it in one formatted search query....
Thanks and Regards,
Atul Joshi
Edited by: Atul Joshi on Dec 23, 2008 5:20 PMHi Atul,
You could define the quey like this
SELECT
CASE
WHEN $[OWTR.series]='46' THEN '08'
WHEN $[OWTR.series]='45' then '02'
end
from OWTR
Regards,
Vijay kumar
SAP Business One Forums Team -
Is there a way to NOT have the data from a formatted search highlighted
Hi all,
I have a formatted search that returns a big chunk of data, some comments that are then added to. When the fs is fired, it returns the data, but all of the data is highlighted so when the user starts typing they overwrite the data that was just returned. I know they could just hit the right arrow key or click their mouse at the end, but they don't do that half of the time. I also know they could use ctrl-z or undo when they do this, but they don't do that either. It would just be nice if they could fire the fs and when the data is returned, the cursor would be at the end of the data.
Any thoughts?I don't think there are any options for you to change default system behavior like this. What you may do is to change your FMS logic to get only one record if possible. Post your query here if you can.
Thanks,
Gordon -
Formatted Search with multiple conditions
Hi experts,
I am using a formatted search to update the Unit price in Sales Order. Query mentioned below.
Select T0.ItemCode,
T0.ItemPrice,
From ITM1 T0 inner join OPLN T1 on T0.PriceList = T1.ListNum
Where T0.ItemCode = '[$38.1.0]'
and T1.u_location = '$[$38.2000002049.0]'
But while adding Item on Sales Order, it is showing error, Incorrect Syntax near '$[$38.2000002049.0]'.
Note: I have added an UDF named U_LOCATION( Alphanumeric, 10) in OPLN and selecting location in Price List through another FMS which is working perfectly.
Please help in this regards.
Thanks in Advance.
NabyenduHi Nabyendu Saha..
You said the u_location as alphanumeric the why you have given 0 for the field type in the FMS...
Select T0.ItemCode,
T0.ItemPrice,
From ITM1 T0 inner join OPLN T1 on T0.PriceList = T1.ListNum
Where T0.ItemCode = '[$38.1.0]'
and T1.u_location = '$[$38.2000002049]'
or
Select T0.ItemCode,
T0.ItemPrice,
From ITM1 T0 inner join OPLN T1 on T0.PriceList = T1.ListNum
Where T0.ItemCode = [$38.1.0]
and T1.u_location = $[ordr.u_location]
Try the above , hope helpful
Regards,
Kennedy -
Outlook 2010 search for contacts of connected account
Hello.
My client has one issue: they can search contacts in their exchange account but the results don't return contacts from an account that she is authorized to (she can see emails from this other account). She doesn't remember what triggered it she just said
it stopped working. The other person has Mac. How do you enable or troubleshoot search shared contacts from connected accounts?
She is using Windows 8 and Outlook 2010 and they have internal exchange server 2007. I have seen this post: http://social.technet.microsoft.com/Forums/en-US/0403a096-49b1-4a87-a34f-44566c9cf9ab/outlook-2010-searching-a-shared-users-contacts?forum=outlook
where it points me to another site but it doesn't say what the problem could be if you can't search from shared contacts.Hi,
Is the user searching within the shared Contacts folder?
Switch to Outlook Online Mode and search, does the issue persist?
Regards,
Melon Chen
TechNet Community Support
It's recommended to download and install Configuration
Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs. -
Auto-refresh formatted search is not working properly...
I have created a User Defined Field in Item Master named: FLD1 (Alphanumeric 30)
Then I have created a User Defined Field in Marketing Documents Row: FLD1 (Alphanumeric 30)
Now I want as follows u2013
In Marketing Documents if I select any Item, the value saved in FLD1 in the Item Master will come automatically in the Field FLD1 of the Marketing Document.
I did as follows u2013
I have created a formatted search for the above marketing document (in Sales Quotation) for the field FLD1 as follows u2013
Option: Search in Existing User-Defined Values according to Saved Query
Query: GetItemFLD1 (SELECT $[OITM.U_FLD1] )
Option: Auto Refresh -
When Exiting Altered Column
Field: Item Description
Option: Display Saved User-Defined Values
But the above is not working automatically --- after saving the document if I click on the Formatted Search Marker then the value comes otherwise not.
Can any one please explain the reason behind?
for SAP B1 2007 B SP0 PL7
Edited by: Narottam Das on May 5, 2009 1:53 PMCheck this thread for explanation of Syntax of FMS:
[Refer to Sales Order From Payment Means;
Refer Suda Sampath reply that explains clearly -
Formated Search: Auto refresh with two conditions.
Hi,
I've created a Formated Search in one of my column.
I defined my formated search as :
- Auto refresh "When Exiting Altered Column" Item No.
- Display Saved Values.
Now how can I make it Auto refresh with two conditions?
- Auto refresh "When Exiting Altered Column" Item No.
And
- Auto refresh "When Field Changes" Customers/Vendor Code.
- Display Saved Values.
Is there any way to make it work?
Thanks In Advance.
Bruce.Hi Bruce,
You could try this trick.
You need to execute SELECT1 in Col1 when Item No. column is altered or the Customer code is changed.
Then, in the Item No. column asign a new Formatted Search which selects the Item No. column value (Its value) when the Customer code is changed.
And in the Col1 asign a formatted search that acts when the Item No. column is altered.
I think this should do the trick.
Let us know if works.
Regards,
Ibai Peñ -
How to display an error message after validation in Formatted Search?
Hi SBO experts,
if an error is detected on validation in a Formatted Search, how to display an error message to the user entering the data?
Thanks & Regards,
Raghu Iyeri created a formatted search query & attached it to the field 'Quantity' at Line Item level in Sales Order screen. just for testing purpose, i eneterd the following code lines in the query validating 'Quantity'
if $[$38.11.0] > 50
begin
select @error = 1
select @error_message = 'Vendor code cannot begin to X sign.'
end
the system throws the error : Internal error (8180) occurred [Message 131-183]
actually, i need to display an error message to the user if Quantity is not in multiples of the OITM.SalFactor2
if $[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode] = $[$38.1.0]) > 0
begin
select @error = 1
select @error_message = 'Error in Quantity.'
end
but, this expression to get the remainder itself seems to have some error
$[$38.11.0] % (SELECT T0.[SalFactor2] FROM OITM T0 WHERE T0.[ItemCode] = $[$38.1.0])
i guess, % operator is used for modulo (to find the remainder of one number divided by another.) ? am i right ?
Regards,
Raghu Iyer -
How do i deduct dates using formatted search with a query
Hi Experts,
I would like to know how to get the date difference using query and formatted search. Below are the details:
1. I have created 3 Header UDF's composed of 2 Date type fields and 1 Quantity field.
2. The first one is for the Original Date, the next one is for the Payment Date and the Last one is for the No. of Days Lapsed.
What I would like to do is automatically compute for the number of days from the original date to the payment date. What query syntax should i use to achieve this?
Thanks,
YvetteHi Yvette,
It should be something like;
DATEDIFF (day, T0.[createDate], T0.[closeDate] ) as 'Aging' This is just an example. You may add your udf's instead of dates.
Thanks,
Joseph
Edited by: Joseph Antony on Jul 2, 2010 1:53 PM
Maybe you are looking for
-
I had several problems downloading the software and plenty of errors. My most recent backup before the update was a day ago. Since downloading the new iOS 5 software I lost all my pictures, and I'm really upset about it. My phone has been synced with
-
My Linksys WRT54gs v4 router will no longer conncect wirelessly to my laptop running Win XP. I tried making sure the name and everything matches in the Wireless Network Connections window. It shows up as linksys_SES_38313 but never connects. It just
-
ActiveX Browser Control - PostData?
Hi, I'm struggling with the activex browser control. I want to be able to post data through it but I can't seem to get the PostData variable filled. E.g. sprite(1).Navigate(URL, "", "", "key=value", "Content-Type: application/x-www-form-urlencoded")
-
Mozilla gives the next crash report ID: dirapiX.dll What to do now ?
When I play mahjong on Unibet, most of the times while playing the game it all of a sudden stops with playing and mozilla sends me a crash report with the following ID : dirapiX.dll What can i do to overcome this problem ?
-
I would like to know if is it bad if I don't want to use foreign keys? is it just a constraint? Is it useful? If I wont use delete on cascade for example is it mandatory to use foreign keys? Please help me with this doubt. Thanks.