Formatted Search Syntax
Hi all,
Can anyone explain the syntax of a formatted search to me? For example, sometimes I need to use the syntax $[$Item.0.0], other times I need to use the syntax $[$table.attribute]
TIA
The reference to the current data is through these type of syntax.
$[Tablename.Fieldname]
Tablename indicates the table, which the active window relates to.
Fieldname the field from the active window.
$[$Field Index. Field Column. Number/Currency/Date.0]
This syntax uses the fields index instead of the specific document table.
This query syntax includes 3 elements:
1.Field index - each field in the active window can be related by a unique index.
2.Field column - In case the required field is a Table field (item code, item name,
price, quantity in marketing documents etc.), it has to be related by index and column
numbers. In case the required field is a Title field, this element should be set to 0.
3.Number / Currency / Date / 0 -
In case the required field includes a number + a currency symbol (item price,
document total), type Number to retrieve the number (without the currency symbol or
the measurement unit). This separation is essential in case the user wish to use the
price for arithmetic expressions.
Type Currency to retrieve the currency symbol or the weight unit.
In case the required field is a Date field, and it has to be used for computation,
type Date.
Similar Messages
-
Round up syntax for Formatted Search
Hi all,
I need help on writing the formatted search syntax for below scenario.
Discount % = 2 decimal place only
Unit Price = 99,376.00
Discount = 30.97%
Price After Discount = 68,599.25
I want the Price After Discount to be rounded up to 68,600. Any idea how to achieve this? Will do this round up in another UDF so that my layout will show the rounded up price to customer.
Even if the Price after discount is 600.02, i wanted the result to be always rounded up to nearest $1 as long as the original price has some amount at the decimal. For this case, should round up to 601.00.
Anyone can help? Thanks in advance.Hi Too Mui Hwee
Will the UDF be varchar or numeric? Do you want the udf to show the currency as well?
I have done both for you. The problem with SQL 2008 & 2012 is that they don't have a roundup function. This is however in version 2014 which is not yet supported by SAP Business One.
Without currency:
SELECT CASE WHEN ROUND($[$38.17.NUMBER],0) < $[$38.17.NUMBER] THEN ROUND($[$38.17.NUMBER],0) + 1 ELSE ROUND($[$38.17.NUMBER],0) END
With currency:
SELECT CASE WHEN ROUND($[$38.17.NUMBER],0) < $[$38.17.NUMBER] THEN $[$38.17.CURRENCY] + ' ' + CAST(ROUND($[$38.17.NUMBER],0) + 1 AS VARCHAR(20)) ELSE $[$38.17.CURRENCY] + ' ' + CAST(ROUND($[$38.17.NUMBER],0) AS VARCHAR(20)) END
Kind regards
Peter Juby -
Fill Find edit box of Formatted search screen
Hi,
I have an edit box and a choose button.
when I click on that choose button I get a formatted search screen.
I want the value typed in the edit box to be defaulted in the
Find Edit box of the foratted search screen.
Say I type "1" in my edit box, My formatted search screen should pop up having "1"
in the Find edit box and results pertaining to value "1"(like wild card search)
should be displayed in the formatteed search screen.
Can anyone tell me as how to implement this?The reference to $[x.0.0] was simply meant to point you towards using the formatted search syntax for selecting fields from the current screen for use in your query.
The two techniques I mentioned were not meant to be used together, you could either use the sendkeys, or the $[x.0.0] syntax depending on which result you wanted.
The $[x.0.0] syntax actually goes in the query that is saved for the formatted search, you don't need to do anything with it programatically at runtime, business one does it for you. You can get a formatted search to pick values up from the current screen by using syntax such as $[$4.0.0] or $[$OINV.CARDCODE]. This particular example will pick up the cardcode from a document screen. Look in the standard help file under Formatted Searches for more details.
I have attached a sample query showing how it can be used with fields based on userdatasources in custom screens. This one can be used to show product lookups out when the user has already keyed in a partial product code. At runtime the $[#018.UItem] reference automatically gets replaced with the value currently in the item field.
DECLARE @Item Varchar(20)
SET @Item = RTRIM($[#018.UItem]) + '%'
SELECT T0.ItemCode, T0.ItemName FROM OITM T0 WHERE T0.ItemCode LIKE @Item FOR BROWSE
If you haven't seen this type of formatted search processing before, I would recommend you try to spend a little time learning it - it sometimes eliminates the need for writing SDK code at all.
Regards,
John. -
Formatted search with UDF and syntax question
Can you explain the syntax with when to use the dollar sign and negative in writing a query for a formatted search based on user entry?
I now want to create a formatted search to pull values based on the user's entry into a UDF on the item master screen.
User entry into UDF U_Customer Code
to create Formatted search for UDF U_Rep01
I tried the following, but it does not work.
SELECT T0.U_REP01 FROM dbo.OCRD T0
WHERE T0.CARDCODE = $http://$OITM.U_CUSTOMERCODE
Thanks.
Please advise.The right syntax would be like this:
SELECT T0.U_REP01 FROM dbo.OCRD T0
WHERE T0.CARDCODE = $[OITM.U_CUSTOMERCODE\]
However, the logic of query may not be correct. Select something must be already in the system and Where should also be locatable.
Thanks,
Gordon -
Date Difference Query Syntax Formatted Search
Hi Experts,
My client renders a service(warehousing of Cargo) on time and material basis,therefore the Quantity column of the AR Invoice represents the number of days the cargo was warehoused.
I want to create a formatted search with reference to a query on this field to help me compute the number of days automatically. The number of days is normally calculated by Subtracting the the Admission date(Serial Number Details Table "OSRI", field "InDate" from the document date of the invoice) from the AR invoice document date.
Considering that the Item is serial number managed, the item serial number will connect the Serial Number details table to the AR Invoice table.
Can anybody help me with the syntax of the query that will achieve the above for me.
Waiting to hear from you .
ThanksIf you have many serial numbers for an item, there will be no way to identify which serial number was actually selected in the invoice till the time the Invoice is added.
So knowing the Serial Number that was selected on that Invoice is important and what you select in the Serial number selection window on the Invoice is stored in temporary location and cannot be referencing by looking into OSRI table.
If there are multiple serial numbers with different InDate's, how could you calculate?
Is there a Delivery Step? Delivery > Invoice
OR
Do you copy SO > AR Invoice directly
Suda -
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 -
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 -
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 -
I canu00B4t do a formatted search in a user table
Hye, I'm trying to do a formatted search over a user table using and I get the error -2006, why?
I use "report generator" and my selecc is :
SELECT T0.U_grupo, T0.U_CODE
FROM T0
WHERE T0.U_grupo ='[%0]' FOR BROWSE
If I do the same with standar table ( e.j OITM), all is right:
SELECT T0.ItemCode, T0.ItemName
FROM OITM T0
WHERE T0.PrchseItem ='[%0]' FOR BROWSE
unless, with user tables no, whyyyy?
thank´I have seen this, though I don't have an official answer, I have my own theories. SBO matches up the variable with the previous field name and looks up the description for that field. The description for user fields is not stored in the same place as standard fields.
In a previous thread, named "SQL Syntax in SBO" (number 7144) another user showed a way to do dummy selects with the variables to get the names of standard fields. Then the variables can be used for the real work.
That is awkward, and it limits you to the descriptions of standard fields.
Bruce -
Query - Formatted Search in a User Defined Field
Hi,
I am having some problems with a very simple query but it doesn't seem to work. I insert this formatted search in to my UDF I made called Cost. The query I am using is:
SELECT $[$34.0.0] - (I had to use variable number because this Unit Price field in the Item master data does not have a field name associated)
It is supposed to grab the unit price from the screen, however it is always displaying zero when I query it, and when I put it in the UDF as a formatted search, it give me the internal error.
I would greatly appreciate your help.
ThanksQuestion 1: Where is this Cost UDF defined. Is it at the Marketing document Header or row level?
NOTE:
The field reference for the Unit Price column is incorrect. When you mouse over the Unit Price column you should see the values for Item=xx Colunm=xx
The syntax is $\[$Item.Column.Type]. Therefore for your case it should be $\[$38.14.Number]
The type prefix can be 0 if you are accessing a Alphanumeric column.
If you user field is at the Header level the Formatted Search Query might not work unless you highlight that whole row and then click on the header level UDF and press Shift+F2
How have you set the refresh options? -
UDF - formatted search help using query
I've created a UDF for 'activities' called U_BP_Link - it has a formatted search query which simply displays all data in the OCRD business partner database. I wanted to also fill in a UDF which would display the 'description' of the BP that was selected in the U_BP_Link field. I'm having trouble coming up with the correct syntax for the query associated with the UDF name field. This is giving me a syntax error near $[$U_BP_Link]................
SELECT T0.CardName FROM OCRD T0 INNER JOIN OCLG T1 ON T0.CardCode = T1.U_BP_Link Where T0.CardCode = $[$U_BP_LINK.1.0]Good Day,
I don't fully understand your situation.
I'm thinking you have 2 UDFs. One is OCLG.U_BP_Link and the second is the 'also fill in a UDF' and that is to be populated with OCRD.CardName based on data entry in OCLG.U_BP_Link
That being the case, I would create a FMS on OCLG.U_BP_Name field to:
1) Search in Saved Query - create query similiar to SELECT OCRD.CardName FROM OCRD, OCLG Where OCRD.CardCode = $[OCLG.U_BP_LINK] FOR BROWSE
Create and test the query and after results are generated as expected, substitue the $[OCLG.U_BP_LINK]. The query will error in SAP but is OK for use in FMS.
2) Auto refresh when Field Changes
3) Based on field OCLG.U_BP_Link - actually the description for this field.
4) Display saved values
It could work.
M -
Selecting the Description field for a UDF when using a formatted search
I am trying to pull the Description field from a UDF on CRD1 in a formatted search in marketing documents.
Here is my current query but I do not know the correct syntax to pull the description instead of the code from the UDF.
SELECT T1.[U_ISEName] FROM OCRD T0 INNER JOIN CRD1 T1 ON T0.CardCode = T1.CardCode
Any help would be appreciated.
Thanks
SteveGordon
I tried your suggestion. On CRD1 I created a FS to pull the name from the OSLP tabel. I then used your query on the sales order to pull the stored value on CRD1.
but now I am getting this error message
1). {Microsoft]{SQL NativeClient} ][SQL Server] Invalid column name 'U_ISE'> 2) {Microsoft]{SQL NativeClient][SQL Server] Statement 'Sales Tax Codes' OSTC (s) could not be prepared.
The name appears to pull
Any suggestions.
Thanks
Steve -
Formatted Search Multiple Sources
Hey all,
I know that standard functionality in formatted searches in SAP B1 does not support multiple source fields. However, I was hoping that someone had come up with a workaround for this scenario.
Field A = Variable
Field B = Variable
Field C = Field A + Field B
Can I get field C to update whenever field A OR field B is updated?
Thanks,
KevinThanks Gordon, that made perfect sense. My solution was this:
Field A -> Formatted Search refresh regularly when Field B changes
Field B -> Formatted Search refresh regularly when Field A changes
Field C -> Formatted Search refresh regularly when Field B changes
This way, if you touch Field A or B, Field C will always be updated. For the queries, I simply used the active screen syntax to pull the values that were already there. For example:
If Field B changes, then Field A = $[$38.Field_A.0]
It's enough to register a change to field A which triggers the whole refresh. Thanks for your recommendation Gordon! -
Help with Formatted search involving a UDF
I have a Formatted search which runns the following code:
exec xsp_nssItemLookup $[$38.256.0]
This search is on a udf of the Purchase order screen. (256 is the item details field in the details.
The above query runs fine. What I really want to do is to pass the contents of another UDF to the stored procedure. The USF is called U_NSSItemID. If I change my stored procedure to read:
exec xsp_nssItemLookup $[$38.U_NSSItemID.0] however it does not work. I get blank results every time.
I have also tried exec xsp_nssItemLookup $[POR1.U_NSSItemID.0] which doesn't work either.
I can't figure out what is wrong with my syntax. I don't get any errors, just a blank value.
Thanks
don shieldsSuda,
Thanks for answering so quickly. To answer your question the data type is Alphanumber which I just figured out is the save as CHAR() in SQL. My problem turned out to be that I needed to trim the spaces from my parameter. I was getting values like "cover ", and I needted to get "cover". Problem solved now.
Don -
Formatted Search working Partially on SDK Field
I have a text field on the Service call screen called
"A"
I need the field to be updated with a value taken from the Item Master table, U_A field.
I have created my query as below,
SELECT I.U_A FROM OITM I
WHERE I.ItemCode = $[$33.0.0]
and set a formatted search on the field A in the Service Call screen to refresh regularly when the Item No field changes.
The Formatted search does NOT fire when the item number changes.
It fires only when I do Shft + F2
HOWEVER if I try the formatted search on a system field on the same screen such as the Description field, then the Item Number Change fires the formatted search.
Does anyone know of this resriction, or a workaround please?
appreciate your help.
Thanks,
IndikaHi Felipe,
The problem happens when I use the formatted query on a text field I created using the SDK only. It works on any other SAP field.
as I mentioned, if I press Shift + F2 then it works regardless.
I tried this on the Item Master screen too with the same result. of course I changed the query to $[$5.0.0].
Threrefore I don't think it has anything to do with the query syntax , rather the SDK field.
in any case here is the code (vb6) I used on the Item Master
Private Function temp(ByRef pval As SAPbouiCOM.ItemEvent) As Boolean
Dim oItm As SAPbouiCOM.Item
Dim oForm As SAPbouiCOM.Form
Dim oRelateItm As SAPbouiCOM.Item
Dim iRelateItmHt As Integer
Dim oEdtBox As SAPbouiCOM.EditText
Set oForm = mObjSBOApplication.Forms(pval.FormUID)
With oForm
'---text
Set oItm = .Items.add("maxGstT", it_EDIT)
Set oRelateItm = .Items("76") 'closed on date edit box
oItm.Left = oRelateItm.Left
oItm.Width = oRelateItm.Width
oItm.Top = mObjSBOApplication.Forms(pval.FormUID).Items("36").Top 'item group top
oForm.DataSources.UserDataSources.add "dsmaxGstT", dt_SHORT_TEXT
Set oEdtBox = oItm.Specific
oEdtBox.DataBind.SetBound True, "", "dsmaxGstT"
End With ' With oForm
End Function
Message was edited by: Indika Dekumpitiya (spelling)
Maybe you are looking for
-
Dear All, We have created a application to load AR Invoice and Incoming Payment through PowerBuilder. While using DI API there is a memory leak. ie.,After loading say 500 AR invoices and corresponding payment, the application seems to hang but after
-
How do I change the Transparency Settings in ACR 8.7.1?
I work on three different computers, one at home and two at work. In Camera Raw on my home computer the transparency section of an image where I have done a major perspective correction will have the checkerboard rendering of the transparency section
-
In the transformation between 0FIGL_O02(table1) and ZSPM_D01(table2), delete records in 0FIGL_O02(table1), if 0AC_DOC_NO AND 0FISCPER AND 0COMP_CODE do not exists in 0FIAP_O03(table 3). need code for this...i have to implement it in BW.pls give me ne
-
Jcontrol is not supported on AIX6.1, Urgent!
When I am trying to install NW04s SR2 on Aix6.1, J2EE engine faild to start due to the following error msg in dev_jcontrol: ERROR => OS release AIX 1 6 000FBC91D900 is not supported with this startup framework (700) [jstartxx_mt. 4392] Can somebody g
-
Sneak Preview Install KMC Error
Install of sneak preview generates following error in KM Content. How to resolve this error. com.sap.portal.pcm.Title Portal Runtime An exception occurred while processing a request for : iView : pcd:portal_content/administrator/super_admin/s