Append Query with multi values
I am attempting to append information into a new database. The old project information has some fields that are multi-value. Apparently an append query cannot handle this. Is there a way I can over come this?
Hi
>>Apparently an append query cannot handle this
Have you got some error? What's the problem you have encountered? Could you please show the sql you are using or share a sample to reproduce this ?
If you're adding a value to your multi-valued field, you can us an append query like this,
Insert into table (FieldName.value) values (value)
Best Regards
Lan
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
How could I replace hard coded value in my sql query with constant value?
Hi all,
Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
PROCEDURE class_by_day_get_bin_data
in_report_parameter_id IN NUMBER,
in_site_id IN NUMBER,
in_start_date_time IN TIMESTAMP,
in_end_date_time IN TIMESTAMP,
in_report_level_min IN NUMBER,
in_report_level_max IN NUMBER
IS
bin_period_length NUMBER(6,0);
BEGIN
SELECT MAX(period_length)
INTO bin_period_length
FROM bin_data
JOIN site_to_data_source_lane_v
ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
JOIN bin_types
ON bin_types.bin_type = bin_data.bin_type
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >= in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time < in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data.bin_type = 2
AND bin_data.period_length <= 60;
--Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
--report.
DELETE FROM edr_class_by_day_bin_data;
SELECT site_to_data_source_lane_v.site_id,
site_to_data_source_lane_v.site_lane_id,
site_to_data_source_lane_v.site_direction_id,
site_to_data_source_lane_v.site_direction_name,
bin_data_set.start_date_time,
bin_data_set.end_date_time,
bin_data_value.bin_id,
bin_data_value.bin_value
FROM bin_data
JOIN bin_data_set
ON bin_data.bin_serial = bin_data_set.bin_serial
JOIN bin_data_value
ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
JOIN site_to_data_source_lane_v
ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
JOIN (
SELECT CAST(report_parameter_value AS NUMBER) lane_id
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'LANE'
AND report_parameters.report_parameter_name = 'LANE'
) report_lanes
ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
JOIN (
SELECT CAST(report_parameter_value AS NUMBER) class_id
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS'
) report_classes
ON bin_data_value.bin_id = report_classes.class_id
JOIN edr_rpt_tmp_inclusion_table
ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >= in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time < in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data_set.start_date_time >= in_start_date_time
AND bin_data_set.start_date_time < in_end_date_time
AND bin_data.bin_type = 2
AND bin_data.period_length = bin_period_length;
END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
bin_data.bin_type = 2But I dont want any hard coded number or string in the query.
How could I replace it?
I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
bin_type CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
Thanks.
Edited by: user10641405 on May 29, 2009 1:38 PMDeclare the constant inside the procedure.
PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
in_site_id IN NUMBER,
in_start_date_time IN TIMESTAMP,
in_end_date_time IN TIMESTAMP,
in_report_level_min IN NUMBER,
in_report_level_max IN NUMBER) IS
bin_period_length NUMBER(6, 0);
v_bin_type CONSTANT NUMBER := 2;
BEGIN
SELECT MAX(period_length)
INTO bin_period_length
FROM bin_data
JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
site_to_data_source_lane_v.data_source_id
JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >=
in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time <
in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data.bin_type = v_bin_type
AND bin_data.period_length <= 60;
--Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
--report.
DELETE FROM edr_class_by_day_bin_data;
INSERT INTO edr_class_by_day_bin_data
(site_id,
site_lane_id,
site_direction_id,
site_direction_name,
bin_start_date_time,
bin_end_date_time,
bin_id,
bin_value)
SELECT site_to_data_source_lane_v.site_id,
site_to_data_source_lane_v.site_lane_id,
site_to_data_source_lane_v.site_direction_id,
site_to_data_source_lane_v.site_direction_name,
bin_data_set.start_date_time,
bin_data_set.end_date_time,
bin_data_value.bin_id,
bin_data_value.bin_value
FROM bin_data
JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
bin_data_value.bin_data_set_serial
JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
site_to_data_source_lane_v.data_source_id
AND bin_data_set.lane =
site_to_data_source_lane_v.data_source_lane_id
JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
FROM report_parameters
WHERE report_parameters.report_parameter_id =
in_report_parameter_id
AND report_parameters.report_parameter_group = 'LANE'
AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
report_lanes.lane_id
JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
FROM report_parameters
WHERE report_parameters.report_parameter_id =
in_report_parameter_id
AND report_parameters.report_parameter_group = 'CLASS'
AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
report_classes.class_id
JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
TRUNC(edr_rpt_tmp_inclusion_table.date_time)
WHERE site_to_data_source_lane_v.site_id = in_site_id
AND bin_data.start_date_time >=
in_start_date_time - numtodsinterval(1, 'DAY')
AND bin_data.start_date_time <
in_end_date_time + numtodsinterval(1, 'DAY')
AND bin_data_set.start_date_time >= in_start_date_time
AND bin_data_set.start_date_time < in_end_date_time
AND bin_data.bin_type = v_bin_type
AND bin_data.period_length = bin_period_length;
END class_by_day_get_bin_data; -
How to force readObejct query with PK value to go to DB?
The default behaviour for read-object queries with a PK value is to use the cache and not go to the database. How can we change this behaviour?
We have cases that a row was deleted by some other process not through toplink, but the corresponding object still in the cache and if you use the readObject query with PK value, the object will be returned as result.
Thanks in advance,There are several mechanisms to disable caching in TopLink. Note that disabling caching will affect your performance.
In 9.0.4 you can use:
- You can configure you cache type to use a WeakIdentityMap to ensure that only referenced objects are cached.
- On descriptor you can call disableCacheHits() and alwaysRefreshCache() in code or click these options on the Caching/Identity tab in the Mapping Workbench.
- Or to explicitly remove a deleted object from the cache uses session.removeFromIdentityMap(), but you must ensure there are no other objects referencing it.
In 10.1.3 you can also use:
- On descriptor you can call setIsIsolated(true) in code, or select isolated in the Caching tab in the Mapping Workbench.
- Alternatively you can set a CacheInvalidationPolicy on your descriptor to ensure objects are not cached for longer than a specified time, or invalidated daily.
- Or to explicitly invalidate a deleted object use, session.getIdentityMapAccessor().invalidateObject() -
CASE Statement in Where Condition with Multi Valued parameter in SSRS
Hi All,
I am little confused while using CASE statement in Where condition in SSRS. Below is my scenario:
SELECT
Logic here
WHERE
Date IN (@Date)AND
(CASE
WHEN NAME LIKE 'ABC%' THEN 'GROUP1'
WHEN ID IN ('123456', '823423','74233784') THEN 'GROUP2'
WHEN ABC_ID IS NULL THEN 'GROUP3'
ELSE 'GROUP4'
END ) IN (@GROUP)
So above query uses WHERE condition with CASE statement from @GROUP parameter. I want to pass this parameter as multi- valued parameter and hence I have used CASE statement IN (@GROUP).
For @Date one dataset will pass the available and default values and
for @GROUP parameters, another dataset will pass the available and default values.
But this is not working as expected. Please suggest me where I am making mistake in the query.
Maruthu | http://sharepoint-works.blogspot.comHi Maruthu,
According to your description, I create a sample report in my local environment. It works as I expected. In your scenario, if the selected values from the Date parameter contains some of the Date field values, the selected values from the GROUP parameter
contains some of GROUPS (‘GROUP1’,’GROUP2’,’GROUP3’,’GROUP4’) and the corresponding when statement is executed , then the dataset returns the corresponding values.
In order to trouble shoot this issue, could you tell us what results are you get and what’s your desired results? If possible, you can post the sample data with sample dataset, then we can make further analysis and help you out.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Hey,
I created a report in Reporting Services where I added multi-value parameter
( Filter). When I run my report, and try to select more than one parameter, I get an error: Incorrect syntax near ','
then i put in parameter expression : join(Parameters!Filter.Value,",")
and add : dbo.ufnSplit before calling parameter in query :
>>> set @valwhere = 'table.field IN (select * from dbo.ufnSplit(' + @Filter + ' , '',''))'
but i still have errors : incorrect syntax near 'text' which is the second value of the picklist of the parameter,
Please Any idea ?
Thanks !!I have sometimes had to collate as default with the SQL query
currently I've just using
CompanyName in
(selectitemfromdbo.fnSplit(@function,','))
In the SSRS report text box I have Join(Parameters!Company.Value,",") -
How to query involving Multi-Value Attributes objects
Hello.
I have one question regarding coherence. We are looking for best and the fastest way to query multi-value attribute of objects. In Coherence User guide there is example, that shows, how can this be made with java.lang.String object:
Set searchTerms = new HashSet();
searchTerms.add("java");
searchTerms.add("clustering");
searchTerms.add("books");
// The cache contains instances of a class "Document" which has a method
// "getWords" which returns a Collection<String> containing the set of
// words that appear in the document.
Filter filter = new ContainsAllFilter("getWords", searchTerms);
Set entrySet = cache.entrySet(filter);
// iterate through the search results
But I would like to know, how can this be made with some other object type. For example I could have object MyCoherenceObject with attribute HashSet<Identifier> idHashSet that would represent Person object that has composite key comprised of name and lastname. Identifier object would contain two attributes of type String: name & value.
So basically I could have two identifiers in list:
public MyCoherenceObject {
public HashSet idHashSet = new HashSet();
public MyCoherenceObject() {
Identifier id1 = new Identifier("name", "John");
Identifier id2 = new Identifier("surname", Smith");
idHashSet.add(id1);
idHashSet.add(id2);
public HashSet getIdentifiers() {
return idHashSet;
This object would later be inserted in coherence cache. When query over coherence cache would be performed I would like all objects where multi-value parameter with name="name" equal "John" and parameter with name="lastname" equal "Smith". My code would look something like this:
Set searchTerms = new HashSet();
searchTerms.add("John");
searchTerms.add("Smith");
// The cache contains instances of a class "Document" which has a method
// "getWords" which returns a Collection<String> containing the set of
// words that appear in the document.
Filter filter = new ContainsAllFilter("getIdentifiers", searchTerms);
Set entrySet = cache.entrySet(filter);
// iterate through the search results
How can this be done. Basically I don't know how to search in multi-value attribute if one value represents arbitrary object and how to tell coherence which getter fuction must be used for comparison. In my case getValue() must be used and not getName().
Second problem:
Coherence must not return Person object with name="Smith" and lastname="John". Here upper filter would be satisified, but problem is that I am looking for person with lastname "Smith" and name "John".
Domain description:
I will have different objects of same type in coherence cache with different multi-value attribute list length. For example some objects will have only one identifier object in list (e.g. Phone "phoneNumber") some two (e.g. Person "name", "lastname") and other objects will have maybe three identifier objects (e.g. City "country", "area", "state").
If there is faster way to do this in Coherence (I saw examples with getters that contain attributes for example), please give me some directions.
Thank you very much for your help.When filtering based on the getIdentifiers, you should add Identifier instances into the searchTerms collection, and it will satisfy all your expectations. If you add simple Strings into that searchTerms collection, then none of your queries will return anything, because the String will never equal() the Identifier instances.
You can also add an index on the getIdentifiers() method. However, the Identifier class should properly implement the equals() and hashCode() methods, and in order to be able to use an ordered index (you don't need that for the current requirements you listed), it should also implement Comparable.
BR,
Robert -
How To Import Into A Table with Multi-Value Fields
Hello:
I have a table with a multi-value field that contains states in which a company does business. It is multi-value because there can be more than one state. I tried to import a text tab-delimited file in which the data was arranged as follows:
Field1 Tab Field 2 Tab OR, WA, CA Tab
The "State field contained the multiple entries separated by a comma (like they appear in a query of the multi-value field), but it won't accept it. Does anyone know how to import into a multi-value field?
Thanks,
Rich Locus, Logicwurks, LLCJoana:
Here's the code I used to populate a multi-value field from a parsed field. The parsing routine could be greatly improved by using the Split function, but at that time, I had not used it yet. FYI... the field name of the multi-value field in
the table was "DBAInStatesMultiValue", which you can see in the example below how it is integrated into the code.
Option Compare Database
Option Explicit
Option Base 1
Dim strInputString As String
Dim intNumberOfArrayEntries As Integer
Dim strStateArray(6) As String
' Loop Through A Table With A Multi-Value Field
' And Insert Values Into the Multi-Value Field From A
' Parsed Regular Text Field
Public Function InsertIntoMultiValueField()
Dim db As DAO.Database
' Main Recordset Contains a Multi-Value Field
Dim rsBusiness As DAO.Recordset2
' Now Define the Multi-Value Fields as a RecordSet
Dim rsDBAInStatesMultiValue As DAO.Recordset2
' The Values of the Field Are Contained in a Field Object
Dim fldDBAInStatesMultiValue As DAO.Field2
Dim i As Integer
' Open the Parent File
Set db = CurrentDb()
Set rsBusiness = db.OpenRecordset("tblBusiness")
' Set The Multi-Value Field
Set fldDBAInStatesMultiValue = rsBusiness("DBAInStatesMultiValue")
' Check to Make Sure it is Multi-Value
If Not (fldDBAInStatesMultiValue.IsComplex) Then
MsgBox ("Not A Multi-Value Field")
rsBusiness.Close
Set rsBusiness = Nothing
Set fldDBAInStatesMultiValue = Nothing
Exit Function
End If
On Error Resume Next
' Loop Through
Do While Not rsBusiness.EOF
' Parse Regular Text Field into Array For Insertion into Multi-Value
strInputString = rsBusiness!DBAInStatesText
Call ParseInputString
' If Entries Are Present, Add Them To The Multi-Value Field
If intNumberOfArrayEntries > 0 Then
Set rsDBAInStatesMultiValue = fldDBAInStatesMultiValue.Value
rsBusiness.Edit
For i = 1 To intNumberOfArrayEntries
rsDBAInStatesMultiValue.AddNew
rsDBAInStatesMultiValue("Value") = strStateArray(i)
rsDBAInStatesMultiValue.Update
Next i
rsDBAInStatesMultiValue.Close
rsBusiness.Update
End If
rsBusiness.MoveNext
Loop
On Error GoTo 0
rsBusiness.Close
Set rsBusiness = Nothing
Set rsDBAInStatesMultiValue = Nothing
End Function
Public Function ParseInputString()
Dim intLength As Integer
Dim intStartSearch As Integer
Dim intNextComma As Integer
Dim intStartOfItem As Integer
Dim intLengthOfItem As Integer
Dim strComma As String
strComma = ","
intNumberOfArrayEntries = 0
strInputString = Trim(strInputString)
intLength = Len(strInputString)
' Skip Zero Length Strings
If intLength = 0 Then
Exit Function
End If
' Strip Any Leading Comma
If Mid(strInputString, 1, 1) = "," Then
Mid(strInputString, 1, 1) = " "
strInputString = Trim(strInputString)
intLength = Len(strInputString)
If intLength = 0 Then
Exit Function
End If
End If
' Strip Any Trailing Comma
If Mid(strInputString, intLength, 1) = "," Then
Mid(strInputString, intLength, 1) = " "
strInputString = Trim(strInputString)
intLength = Len(strInputString)
If intLength = 0 Then
Exit Function
End If
End If
intStartSearch = 1
' Loop Through And Parse All the Items
Do
intNextComma = InStr(intStartSearch, strInputString, strComma)
If intNextComma <> 0 Then
intNumberOfArrayEntries = intNumberOfArrayEntries + 1
intStartOfItem = intStartSearch
intLengthOfItem = intNextComma - intStartOfItem
strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
intStartSearch = intNextComma + 1
Else
intNumberOfArrayEntries = intNumberOfArrayEntries + 1
intStartOfItem = intStartSearch
intLengthOfItem = intLength - intStartSearch + 1
strStateArray(intNumberOfArrayEntries) = Trim(Mid(strInputString, intStartOfItem, intLengthOfItem))
End If
Loop Until intNextComma = 0
End Function
Regards,
Rich Locus, Logicwurks, LLC
http://www.logicwurks.com -
SAP BI & ABAP: Select with multi values
Hi all experts,
I'm pretty new in this forums, and i have a variable with customer exit, multiple values. This variable return several closing date (MM.YYYY) for a input plant. Below my sample code:
WHEN 'VARIABLE_NAME'.
CHECK i_step = 2.
*a plant
CLEAR w_plant.
*a project
CLEAR w_project.
*a version
CLEAR wt_version.
*a closing period for a budget
CLEAR w_cloper.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'plant_input'.
w_plant = loc_var_range-low.
w_project = loc_var_range-low(7).
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_PROJ_INPUT'
EXPORTING
input = w_project
IMPORTING
output = w_project.
SELECT * INTO TABLE w_version_table
FROM version_table
WHERE project = w_project. --> in this step i have multi value in my internal table.
If sy-subrc = 0.
LOOP AT w_version_table INTO wt_version_table.
CLEAR l_s_range.
l_s_range-low = wt_version_table-o_cloper.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range. --> in this step i get single value, last value in the internal table.
ENDLOOP.
ENDIF.
My code work it, but my variable return a single value. Which part of code i changed it to get all values.
Best regards.
DaousHi Daous,
if this is a BI question, would you mind posting it in one of the forums for BI & Analytics?
This here is really about search...
Best, Karsten -
Using "Update All Mapped Fields" with multi-value attributes
Is it possible to update a value in a multi-value attribute through the import manager? It appears that if a source value is different then it just gets added as another value to the record.
For example, a product has an attribute of speed which is measured in revolutions/minute. Some products can be rated at two speeds (i.e. 1800/3600).
I created a numeric attribute for speed and enable only nominal rating and selected multi-valued.
In import manager, I set "/" as multi delimiter for source field. This created two entries in destination attribute, 1800 and 3600.
However, if on subsequent imports the speed values changes for this record (i.e. 1200 and 1800) then I will now have 1200, 1800, and 3600 as values for this record.
Would the proper solution be to create two individual numeric attributes that are single valued (i.e. Speed1 and Speed2)?Hi Aaron,
in your example it would make sense to use two different attributes called "Speed1" and "Speed2". Using the multi value option, MDM allows you to store a list of values into a single field. This list is more or less unlimited, you can add as many values as you like. A change of an existing value is not possible. The reason is that Import Manager does not know, which value you've changed! So it simply adds the "new" record (which is the 1200 in your example) to your value list. This is the intended behaviour of the "update all mapped fields option". If you really want to replace the values, you can check if the "Replace" option is useable for you. But note, that the replace will replace the complete existing record with the incoming new one. This means if the product you want to import with the replace option is smaller than the existing one (maybe it does not contain values for all segments), you'll loose data in MDM.
BR Michael -
Infoset query with cero values
Hi
I have an infoset query that reads the information from an infoset. The infoset query is able to read the values, because it shows me values, but everything is cero, although I have values different from 0.
But if it didn`t find values it would tell me a different message as "No application data found" or something like this.
Then the problem is, my infoset read values, but everything that shows me is cero, and that´s not true.
Thanks and regards
SEM SEMHi,
What do you mean with the join condition ?
I have an infoset query with only one ODS inside. I didn´t want to build a query directly to the ODS as I did´t want to mark the flag available for reporting in the ODS, as it already had very importat data and I didn´t want to damage the ODS data. That´s why I have built and infoset query with one ODS inside, and in this case I don´t understand the join condition....
Regards
SEM SEM
Does anybody know something ????
Regards
SEM SEM
Message was edited by:
SEM SEM -
Access 2007 : Dealing with multi-values
The only option I can find has been to export any multi-value tainted tables as text for future reference, then delete all those columns in order to convert the database to 2003.
Is this the best approach?Benjamin,
you can try the following:
(1) make the :ac bind variable public in the Customization Form Display Options tab. This way the :ac bind variable becomes the ac public portlet parameter;
(2) create a page parameter and name it ac in the Parameters tab of the page properties;
(3) wire the ac page parameter to the ac portlet parameter. This ensures that your portlet receives the page parameter value from the page URL;
(4) read the parameter value in the portlet's code. Here you have two options:
- read it in SQL statement:
<ORACLE>select * from hr.employees
where department_id in (:ac)</ORACLE>- read it in PL/SQL block by using PL/SQL API:
<ORACLE>
declare
l_names owa.vc_arr;
l_values owa.vc_arr;
begin
wwpro_api_parameters.retrieve(l_names, l_values);
htp.p('Number of portlet parameters: '||l_names.count);
htp.br;
for i in 1..l_names.count loop
htp.p('Parameter name: '||l_names(i));
htp.p('Parameter value: '||l_values(i));
htp.br;
end loop;
end;
</ORACLE>Hope this helps,
Sergei -
Append table with multi-line cells to word report
Hi,
I am using LabView 7.0. I need to append table to word report and I am using Append Table to Report VI. My VI works fine as long as the table cells do not have multiple lines. For multiple lines, each line is put is a seperate cell in the word report.
Is there a way to append multi-line cells to Word Report??? If not, any suggestions on how I can copy the multi-line table to Word report???
Please kindly help!!
Please see the attached document for details on the problem.
Thanks,
Mim
Attachments:
Table with multiple line cells.doc 33 KBHi Mim,
Yes I understood the multiple-lines part. I think the doc is the report you want. Correct ?
The doc is generated with your VI without any modifications.
I am using XP, Office 2002 SP3 and LV7.1
Attachments:
Verification Report.doc 39 KB -
CAML Query with Javascript value
Hey everyone,
I am building an Sharepoint 2013 app (SharePoint-Hosted) and using a CAML Query to get the current Item.
The Current Item ID is 1 and i stored it in AccountID, but i want that variable inserted in the CAML Query so i get the proper information.
var AccountID = 1
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=ID LookupId="TRUE"/><Value Type="Text">1</Value></Eq></Where></Query></View>');
But instead of putting the '1' value in the CAML Query, i want the variable AccountID in it... but how?
Already tried this, but that didn't work:
camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=ID LookupId="TRUE"/><Value Type="Text">' + AccountID + '</Value></Eq></Where></Query></View>');
Can someone help me with this?
In forward, many thanks!Right, you have to use single quotes in a string literal inside double quotes. Just making sure it didn't have NO quotes, as your initial post showed.
Is the ID field actually a lookup field? Or is it just the built-in ID field of the list? If it isn't a field of TYPE Lookup, try this:
camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" + AccountID + "</Value></Eq></Where></Query></View>");
Danny Jessee
MCPD - SharePoint Developer 2010
MCTS - SharePoint 2010, Configuring
dannyjessee.com/blog -
PHP+MySQL query with empty value
Hi!
Software is DW8 with Apache 2.0.48, MySQL ver. 4.0.15a, PHP
4.2.3.
We had problem when a submitted value for 'regionID' in the
submit page
was left blank and the following error message appears in the
result page:
"You have an error in your SQL syntax. Check the manual that
corresponds
to your MySQL server version for the right syntax to use near
'LIMIT 0,
3' at line 1"
The problem was solved by adding at the top of the page:
<?php
if (isset($_POST['regionID']) &&
empty($_POST['regionID'])) {
$_POST['regionID'] = '0';
?>
How to change the above code to retrieve ALL records when an
empty \
blank value is submitted for 'regionID'?
TIA
Nanubbgirl wrote:
> Something I picked up at a PHP/MySQL seminar...
$_REQUEST works in place of
> either $_GET or $_POST. It basically means use either
get or post. But it is
> less precise because it can pick up either variable and
has to think about the
> request...
I'm afraid you've picked up rather poor information.
$_REQUEST relies on
register_globals being turned on. Since register_globals is
considered a
major security risk, the default setting has been off since
April 2002.
Many hosting companies have turned register_globals on, in
spite of the
security problems, because so many poorly written scripts
rely on it.
The PHP development team has decided to resolve this security
issue once
and for all by removing register_globals from PHP 6.
Forget $_REQUEST. Use $_POST and $_GET always. It's safer,
and it's
futureproof.
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/ -
Query with scalar valued function with date filter
Hello experts
i have a problem by filtering my results with the date
i have written the following code
SELECT
T1.ItemCode
, T1.Dscription
,DBO.F_CALCULATION_QUANTITY(T1.ITEMCODE)
FROM OINV T0
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OSLP T3 ON T0.SLPCODE=T3.SLPCODE
WHERE
(T0.DOCDATE BETWEEN '2010-11-01' AND '2010-11-30')
and (t2.cardcode ='80022')
and (T0.CANCELED= 'N')
group by t1.itemcode, T1.Dscription, t2.suppcatnum
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER FUNCTION [dbo].[F_CALCULATION_QUANTITY]
(@ITEMCODE AS NVARCHAR(10))
RETURNS
NUMERIC(19,2)
AS
BEGIN
DECLARE
@RESULT1 AS NUMERIC(19,2),
@RESULT2 AS NUMERIC(19,2),
@RESULT AS NUMERIC(19,2)
SELECT @RESULT1=SUM(A.QUANTITY)
FROM INV1 A
JOIN OINV B ON A.DOCENTRY=B.DOCENTRY
WHERE A.ITEMCODE=@ITEMCODE
AND B.DOCDATE BETWEEN '2010-11-01 00:00:00.000' AND '2010-11-30 00:00:00.000'
SELECT @RESULT2=SUM(A.QUANTITY)
FROM RIN1 A
JOIN ORIN B ON A.DOCENTRY=B.DOCENTRY
WHERE A.ITEMCODE=@ITEMCODE
AND B.DOCDATE BETWEEN '2010-11-01 00:00:00.000' AND '2010-11-30 00:00:00.000'
SELECT @RESULT=ISNULL(@RESULT1,0)-ISNULL(@RESULT2,0)
--SELECT @RESULT=@RESULT1- @RESULT2
RETURN @RESULT
END
the problem i have is that i want to filter my results accoring to the date provided by the user. i want it to be dynamic query.
by now, what i do is to edit the docdate in the function in order to get the desired results. this is not what i want.
could you please help me on this way in order to let the user to input the date?if i add the [%] in the query, it does not bring me the right resultsi have already edited the function to
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER FUNCTION [dbo].[F_CALCULATION_QUANTITY]
(@ITEMCODE AS NVARCHAR(10),
@STARTDATE1 as DATETIME,
@ENDDATE1 AS DATETIME
RETURNS
NUMERIC(19,2)
AS
BEGIN
DECLARE
@RESULT1 AS NUMERIC(19,2),
@RESULT2 AS NUMERIC(19,2),
@RESULT AS NUMERIC(19,2)
SELECT @RESULT1=SUM(A.QUANTITY)
FROM INV1 A
JOIN OINV B ON A.DOCENTRY=B.DOCENTRY
WHERE A.ITEMCODE=@ITEMCODE
AND B.DOCDATE BETWEEN (@STARTDATE1) AND (@ENDDATE1)
SELECT @RESULT2=SUM(A.QUANTITY)
FROM RIN1 A
JOIN ORIN B ON A.DOCENTRY=B.DOCENTRY
WHERE A.ITEMCODE=@ITEMCODE
AND B.DOCDATE BETWEEN (@STARTDATE1) AND (@ENDDATE1)
SELECT @RESULT=ISNULL(@RESULT1,0)-ISNULL(@RESULT2,0)
RETURN @RESULT
END
could you please how to edit the query as well?
i have added the following code and it comes up with the right itemcode but the quantity does not work
DECLARE
@ITEMCODE AS NVARCHAR(10),
@STARTDATE1 as DATETIME,
@ENDDATE1 AS DATETIME
SET @STARTDATE1=(SELECT MAX(T0.DOCDATE) FROM oinv t0 WHERE T0.DOCDATE='2010-11-01')
set @ENDDATE1=(SELECT MAX(T0.DOCDATE) FROM oinv t0 WHERE T0.DOCDATE='2010-11-30')
SELECT
T1.ItemCode
, T1.Dscription
,DBO.F_CALCULATION_QUANTITY(@ITEMCODE,@STARTDATE1,@ENDDATE1)
FROM OINV T0
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OSLP T3 ON T0.SLPCODE=T3.SLPCODE
WHERE
(T0.DOCDATE BETWEEN @STARTDATE1 AND @ENDDATE1)
and (t2.cardcode ='80022')
and (T0.CANCELED= 'N')
group by t1.itemcode, T1.Dscription, t2.suppcatnum
the result is this
70200 alert1 0.00
70210 alert2 0.00
70220 alert3 0.00
70230 alert4 0.00
as you can see the quantity is 0 and it shouldnt be
Edited by: Fasolis Vasilios on Oct 31, 2011 10:49 AM
Maybe you are looking for
-
Can we transfer customer master from ECC to SAP AII
Hi Experts, We need to transfer the customer master data from ECC to SAP AII ( Auto-id system ) through XI system. There seems to be no std XI content for doing this ( there is std content for sending material master ). I have found out an idoc type
-
Add video feedback to quiz question
There is a presentation demo on the Adobe site called 'Breeze for Rapid-training' which has a question and when answered, plays a video. I cannot seem to find any information to do this. how is it done? Thanks Michelle
-
How can we make screen fields obligatory?
hi, guru's how can we make screen fields obligatory while desiging a screen in screen painter (se51)? regards, satheesh.
-
Functional spec and its preparation
what ia functional spec in sap sd and how to prepare functional spec in sap sd implementation
-
Reduced sound zen micro 6gb - from limited knowledge pers
Hi We bought mp3 zen micro 6gb pink, in Feb for our daughter. In June she said the volume whether on the docking/speaker station or through the earphones was greatly reduced. When on 'high' you can just hear the music. I tried to read other posting r