PowerShell - Unable to save Default Column Values
I have created a document library (A) in a Team Site. I have created 2 folders (B and C) inside the document library. I have added a content type to the library. The Content Type contains 2 columns rmName and rmKey (both internal names). I want to set
a column level default on the column rmKey for folder B only. I tried the following code and this does not set the default:
$web = Get-SPWeb "http://abc:39325/sites/COSC"
$list = $web.Lists["A"]
$defaults = New-Object -TypeName Microsoft.Office.DocumentManagement.MetadataDefaults -ArgumentList $list
$folder = $web.GetFolder("sites/COSC/A/B")
$defaults.SetFieldDefault($folder, "rmKey", "Default Value")
$defaults.Update()
I tried replacing $folder with $list.RootFolder. This works, but it sets the default on the Library and both Folders instead of only folder B.
$web = Get-SPWeb "http://abc:39325/sites/COSC"
$list = $web.Lists["A"]
$defaults = New-Object -TypeName Microsoft.Office.DocumentManagement.MetadataDefaults -ArgumentList $list
$defaults.SetFieldDefault($list.RootFolder, "rmKey", "Default Value")
$defaults.Update()
What am I doing wrong in the first script? I feel there is something wrong in $folder. I tried using the Guid of "B" as weel as recursion to get folder but was not able to set the default value on "B".
I was able to get it to work by changing the way I get $folder
$defaults = New-Object -TypeName Microsoft.Office.DocumentManagement.MetadataDefaults -ArgumentList $list
$folder = $list.RootFolder.SubFolders["B"]
$defaults.SetFieldDefault($folder, "rmKey", "Default Value")
$defaults.Update()
Similar Messages
-
Copy table structure with default column values
Hi....
I created a table by copying another table structure by using below query.....
SQL> CREATE TABLE SAMPLE_TEMP AS SELECT * FROM SAMPLE WHERE 1=2;
But my problem is " the default column values are not copied to new table"
Suggest a query like that it should " copy a table structure and default values on columns "
Thanks in advancehi,
One more option would be "dbms_redefinition' - it would work as per your requirement.
refer further to documentation : http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_redefi.htm
- Pavan Kumar N -
Possible to set a default column value to an expression?
Hi,
Is it possible to set a default column name to an expression when creating a table?
For example, I wish to set the default value of a column to read from another table's column and do some arithmetic....is this possible?
Thanks.Yes, you can, with trigger Before Insert for Each row
But be carefull, you can hit the mutating table problem... -
Powershell Script - Convert Managed Metadata column Value to string
HI,
I have written a small PowerShell Script to pull records from a SP List and put them in a csv file. Here is the script:
$MyWeb = Get-SPWeb "http://dev-apps:8800/applications/PA"
$MyList = $MyWeb.Lists["Alist"]
$exportlist = @()
$Mylist.Items | foreach {
$obj = New-Object PSObject -Property @{
“PName” = $_["Port Name"]
"AName" = $_["Agent Name"]
"Address 1" = $_["Address 1"]
"Address 2" = $_["Address 1"]
"Address 3" = $_["Address 3"]
"Address 4" = $_["Address 4"]
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\Filename.csv'
The script is running all right, the output file is also created, data is also correct for all columns but 1. This PName is a
Managed metadata type column and the output values I am getting for this column are like this:
"ERICA|a6d1e8fd-1f6b-4e09-9830-d21e35950881"
"CLIVE|24dff17f-a1b5-4abe-ae86-57299e1e098b"
viz. the ["Actual Value"|"its GUID"] (seems so). I do not want this GUID to be included in the result csv. Is there a way to remove it.
P.S. Choice column values are being fetched just file.Try this (you'll need to add in your other properties)
$items = New-Object psobject
$items | Add-Member -MemberType NoteProperty -Name "AName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "PName" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address1" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address2" -value "" ;
$items | Add-Member -MemberType NoteProperty -Name "Address3" -value "";
$exportlist = @();
$Mylist.Items | foreach {
$pname = $_["PName"] -as [Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue];
$obj = $items | Select-Object *;
$obj.AName = $_["AName"];
$obj.PName = $pname.Label;
$obj.Address1 = $_["Address 1"];
$obj.Address2 = $_["Address 2"];
$obj.Address3 = $_["Address 3"];
$exportlist += $obj
$exportlist | Export-Csv -path 'C:\AData.csv'
Regards, Matthew
MCPD | MCITP
My Blog
View
Matthew Yarlett's profile
See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
Upload and Crop User Profile Photos -
Unable to set the column values in Standard alv settings
Hi,
In the ALV displays settings screen, I can set any number as "number of columns displayed", press "apply" it remains 8 columns that are visible.
Prevousely its working fine, last two days back i added two fields in that AlV table. after that i am unable to change column values in ALV settings.
Can any one tell me how to resolve this issue.
Regards,
DhananjayaAdding fields should not affect the settings normally.. is your program fully activated and you have not mentioend any settings explicitly in your code rite?
-
Unable to pass report column value to url in select statement. Please help
Hi all,
I am trying to pass the report column value as follows:
select key, num,
case when Attachmentcnt(KEY) != 0 then
'f?p=&APP_ID.:91:&SESSION.:'' '':NO::P91_KEY,P91NUM,P91_PREVPG:'And I am passing values as follows:
{noformat}
'#KEY#,'#NUM#','9' ELSE null
END Attachment
from tableA
{noformat}
But, I am not able to figure out correct sysntax to pass these column values. Can anyone give me some help. I appreciate it.
rgds,
Suma.
Edited by: sumak on Jun 23, 2009 12:11 PM
Edited by: sumak on Jun 23, 2009 12:22 PMSuma,
If you're trying to generate a column with a URL, try something like the following:
select key, num,
case when Attachmentcnt(KEY) != 0 then
'f?p=&APP_ID.:91:&SESSION.:'' '':NO::P91_KEY,P91NUM,P91_PREVPG:'
|| tableA.key || ',' || tableA.num || ',' || :P91_PREVPG
else NULL
end
FROM tableA;
But the best way to pass these would include checksum values against the values of your parameters (to make sure a user doesn't hack them). You'll need to check the Apex User manual for details - See "Understanding Session State Protection".
Good luck,
Stew -
Default Column value in case of null
Hi friends,
I am new to dimensional query and need help to set the default value for columns. The query is mentioned below. I need to include the default values when the data for the column is null. How to implement this?
Query:
SELECT distinct s_id,SName, ENV_TYPE, h_id
FROM (
select s_id,s_code,s_value from table
where s_id = 6070
MODEL
IGNORE NAV
PARTITION BY
(s_id)
DIMENSION BY
(s_code)
MEASURES
(s_value,CAST( '' AS VARCHAR2(256) ) AS SName, CAST( '' AS VARCHAR2(256) ) AS ENV_TYPE, 0 AS h_id )
RULES UPDATE
SName[ANY] = service_value['SName'],
ENV_TYPE[ANY] = s_value['ENV_TYPE'],
h_id[ANY] = s_value['h_id']
Output:
S_id SName ENV_TYPE h_id
6070 null null nullI made two changes in the query :
1) Replace service_value to s_value
2) Added a closing ")" for the update
And after making the changes when I ran the query it worked with NVL
create table t_test_data
s_id number,
s_code varchar2(30) ,
s_value varchar2(30)
create table succeeded.
insert into t_test_data
select 6070,null,null from dual union all
select 6080,null,null from dual;
2 rows inserted
SELECT DISTINCT
s_id,
nvl(SName,'Some name') as SName,
nvl(ENV_TYPE,' Some env') as ENV_TYPE,
nvl(h_id,0) as h_id
FROM
SELECT
s_id,
s_code,
s_value
FROM
t_test_data
WHERE
s_id = 6070
MODEL IGNORE NAV PARTITION BY (s_id) DIMENSION BY (s_code) MEASURES (
s_value,CAST( '' AS VARCHAR2(256) ) AS SName, CAST( '' AS VARCHAR2(256) ) AS ENV_TYPE, 0 AS h_id ) RULES
UPDATE
( SName[ANY] = s_value['SName'], ENV_TYPE[ANY] = s_value['ENV_TYPE'],
h_id[ANY] = s_value['h_id'] );
S_ID SNAME ENV_TYPE H_ID
6070 Some name Some env 0 -
Column not showing up in Change Default Column Values settings
There is a column that appears in the view without a problem but we are not seeing the column in the Library settings "Columnd Default Value Settings" We see other similar columns (single line of text) from the same content type but
we are not seeing this one. I am not sure why and and not really sure how to start troubleshooting this. curious.
davidhSeems strange issue, but i have few questions. What is the type of the column which is missing?
Is this content type is custom one and developed using Visual studio? do you see the same behavior when you try to create from UI(I think you should see same behavior)? did you try creating/developing the content type in other site template?
My Blog- http://www.sharepoint-journey.com|
If a post answers your question, please click Mark As Answer on that post and Vote as Helpful -
Tabular form default column value bug when using named notation?
Hi,
I am using Application Express 4.0.2.00.07
After exporting and importing an application, the default value of a tabular form column results in an "ORA-00907: missing right parenthesis" error.
My original application uses named notation while calling my function (no problem here):
Report Attributes > Column Attributes > Tabular Form Attributes > Default type = PL/SQL Expression or Function > Default = pkg_customers.some_funtion (*in_param =>* :P15_FK_CUSTOMER_ID).
When I change this in my imported application to ... > Default = pkg_customers.some_funtion (:P15_FK_CUSTOMER_ID) everything works fine again.
Is this a known bug or is there something I do not see?
Regards,
Frederik Van de Velde.yes it is
p_column_default=> 'calpa_pkg_klanten.fun_sm_betreft_default (in_pk_klant_id => :P9_FK_KLANT_ID)',
p_column_default_type=> 'FUNCTION',
by default it is set exactly the same, but when running the page the tabular form does not render because of the usage of " =>".
thx -
APO DP Unable to save negative forecast values
Hi,
We are not able to generate negative statistical forecast in our system in the background or in the foreground. When the system is supposed to generate negative values, we receive the message "Forecast will be negative". Our business requirement is to allow negative values to be generated.
I am using SCM7 EHP2. All key figures allow negative values to be entered, we did manual test entering data in the data view then saving -xx in cells and it works well. When background jobs are ran, the messages that are supposed to allow negative values are checked.
Any ideas?
Thanks,Hi Maxence,
I have had a similar requirement to see negative forecast.
Anyway, it seems it is a standard DP behaviour. Take a look this note.
1745808 - Negative forecast values set to zero
According to this note, If you do not want to set negatve forecast value to zero, you have to modify the standard program to set the global parameter GV_NEGATIVE_FORECAST in class /SAPAPO/CL_PE_FCS_SERVICE with value 'X'.
Best Regards,
Mariano -
Unable to save lookup field data in SharePoint 2013 online list
Dear Support,
I had successfully created provider hosted app and deployed on SharePoint 2013 online site, in my project I created orderservice.asmx.cs web service and write a code for save record on SharePoint
2013 online list as I mentioned below and calling on App1.js file.
But I am unable to save lookup field value as mentioned below code
Customer is a lookup field I want to save data in SharePoint 2013 online list( Order)where I had successfully
inserted text field data (Title &
Special_x0020_Instruction).
i am getting error as mentioned below
500 Internal Server Error {"Message":"Invalid web service call, missing value for parameter: \u0027Title1\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary`2
parameters)\r\n at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData,
IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}
Please let me know the code how to insert lookup field value (Customer)
in SharePoint online list.
OrderService.asmx.cs
Public
int InsertOrder (Order
orderRecord)
pwd.MakeReadOnly();
clientContext.Credentials =
new
SharePointOnlineCredentials (myUserName, pwd);
try
Web
oWeb = clientContext.Web;
ListCollection lists = oWeb.Lists;
List oOrderlist = clientContext.Web.Lists.GetByTitle("Order");
clientContext.Load<ListCollection>(lists);
clientContext.Load<List>(oOrderlist);
ListItemCreationInformation
itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = oOrderlist.AddItem(itemCreateInfo);
oListItem["Title"]
= Title; listItem["Special_x0020_Instruction"]
= orderRecord.Instruction;
listItem ["Customer"]
= orderRecord.CustomerId;
listItem.Update();
clientContext.ExecuteQuery();
return 1;
catch
return -1;
App1.JS
$("#Save").click(function
debugger;
var OrderProfile = $('#orderprofile').val();
var CustomerId = $('#exCustomerlist').jqxComboBox('getItem',
$('#exCustomerlist').val());
//var Instruction = $('#instruction').val();
alert(OrderProfile);
alert(CustomerId);
var obj = {
'Title': OrderProfile,
'Customer': CustomerId }
$.ajax({
url:
"OrderService.asmx/InsertOrder",
type:
"POST",
dataType:
"json",
data: JSON.stringify(obj),
contentType:
"application/json; charset=utf-8",
beforeSend:
function (XMLHttpRequest) {
//Specifying this header ensures that the results will be returned as JSON.
XMLHttpRequest.setRequestHeader("Accept",
"application/json");
success:
function (response) {
$(".errMsg ul").remove();
var myObject = response.d;
alert(myObject);
error:
function (response) {
alert(response.status +
' ' + response.statusText +
' ' + response.responseText);
Regards,
AkhileshHi Alex Brassington,
Thanks for your reply.
I am having the Site Administrator Permission of the public site.
I am having the permission of Company Administrator of that site but still unable to find
Device Channel on Site Setting. still I gave the user full control from Site Permission but nothing is happening.
What should I do next? -
Retrieving old column values from a after delete trigger dynamically
I have a single audit table for deletions
and the table structure has the following columns
1: table_name
2: column_name
3: column_value
I am writing a trigger on tables for which i want to have delete audits and i am dynamicaly
retrieving the column names but i am unable to retrieve the column value dynamically;
I tried to use the following statement but doesn't return the column value
sql_stmt:= 'select :1 from dual';
execute immediate sql_stmt into col_value using
':old.'| |v_col_name;
where v_col_name is the name of the column which i retrieve dynamically using the
dbms_sql.describe_columns procedure.
Is their any way if i can retrieve the old column values in the trigger dynamically if i already
have the column names in variables..
Thanks in advance.
nullI don't know if Kevin's tip Help Mr. Sameer, but it did help me gain access to pre-deleted row column values.
I did discover, however, that if the columns from the about-to-be-deleted row are used as inserts into another table, Oracle serves up a nasty-gram informing the user that values from the about-to-be-deleted table are unreliable.
I was able to circumvent this constraint by assigning the about-to-be-deleted column values to local PL/SQL varables, then perform the insert using the variable values.
-Bill McNamee
NHDOT
[email protected] -
SQL*Plus: Comment appears in Default-Column
Please look at this commands, executed in SQL*Plus (Oracle 10g):
create table t1 (
c1 number,
c2 number default 0 -- comment in sqlplus
select column_name,data_default from all_tab_columns where table_name='T1';
COLUMN_NAME DATA_DEFAULT
C1
C2 0 -- comment in sqlplus
The comment is stored in the data dictionary! ?:|
insert into t1 (c1) values (0);
commit;
But the default clause works:
select c1,c2 from t1;
C1 C2
+0 0+
Is it a bug or is it a feature???
Greetings from Germany
WolfgangFrom: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_constraints.htm#sthref626
Setting Default Column Values
Default values can be defined using any literal
Bug or feature?
It depends on how literal you interprete literals?
!http://www.designer-daily.com/wp-content/uploads/2009/06/bug-feature.jpg! -
Unable to save column as system wide default
Hi All,
I am in 11.1.1.1.6, I am trying to the save a column as system wide default in 11g but my changes are not getting saved or reflected?
This is what I did using the "weblogic" user name and password
1. Pulled a column EmpName in the criteria
2. Added an action link to that column, which points to another dashboard page Page1
3. Saved as system wide default by clicking on save as system wide default for "EmpName"
4. Restarted the presentation services.
Now when again logged in, and selected that column in my request, what I expect to see (when I run the request and go to results) is that navigtion applied on this column which will take me to the dashboard page Page1.
But this is not happening, What is that I am missing? Can anybody please let me know
Thanks,
RonnyThanks Deva for your reply, I don't have access to Oracle support, I'll have to go back to my client saying that this is a bug,
Can you please confirm that this bug which you mentioned is related to not being able to save the column properties as system wide default in obiee 11.1.1.1.6.0 version?
Also what i just found online is that this bug was fixed in 11.1.1.1.6.2? Can you please confirm this?
Thanks,
Ronny -
I've run into a strange problem with the table control. Basically, even though I set default cell values for a particular column as numeric, when I try to add items to the list it tries to add them as strings, and returns an error message that it is expecting *char instead of int. Furthermore, when I open the uir file that contains the table in question in 2010, it appears as if the default cell values for that column are still set as strings, even though in 2009 when I open the uir file it shows as numbers. I tried converting the uir to C code, and sure enough the C code indicated that the column still is a string type.
I've gone ahead and made a small project to show the issue. If you open this project in labwindows 2009 and click on the table in the table_bug.uir, and edit default cell values for column 1, you will see that the cell settings have type as numeric and data type as int. When you run the project, however, it will fail with an error message saying that it is looking for a *char. When this same project is loaded into labwindows 2010, clicking on the table in table_bug.uir and edit default cell values (column 1) shows the type as string. When I change this to numeric (and change numeric attribute to int), this runs fine in 2010. I tried simply changing the uir in 2010, and then using it in 2009, but 2009 complains that the uir is from a newer version (understandable). If there is any workaround that would let me continue to use 2009 for the time that would be great.
Any help would be greatly appreciated.
thanks,
Alex Corwin
Solved!
Go to Solution.
Attachments:
table_bug.zip 324 KBI opened the UIR in 2009 (but I have 2009 SP1) and it still showed that the default value for the first column was a string. I didn't have any problems changing it to a numeric int, and then building and running the project without error.
Here are a few things you can try:
1) Change the default value to a string. OK out of the dialog, re-enter the dialog, and change it back to Numeric int. Resave and see if the problem has gone away.
2) You said you get a ".UIR is from a newer version" error when opening the 2010 UIR in 2009. Does the UIR still open if you click okay? Often times this will work just fine. Assuming you don't have any problems with this, make a minor change to the UIR in 2009, such as moving the table to the left, and then back to the right and then re-save. See if your program works now.
Kevin B.
National Instruments
Maybe you are looking for
-
HT3529 Can I send pictures from my iPhone to a Galaxy S4?
My friend has a Galaxy S4 and we've been trying to send pictures back and forth from my iPhone and from her Galaxy with no success. Is it possible to send pics from an Apple device to Galaxy/Android device? Thanks!
-
OEM console doen't work after deploy.
hi gurus again. i'm deployed an EM five minutes ago by issuing to these commands: emca -repos create emca -config dbcontrol db everything was good, but one thing still disturbs me. at the end of configuration EM, there was such line: INFO: >>>>>>>>>>
-
I'm using a chat where I often copy links; if I forget to click the text field when copying an URL, it opens, forcing me to go back manually, which is really annoying. Can I disable URL autoopening somehow?
-
Recent Pandora update did NOT fix a glaring problem
The problem being when you lock your Touch (screen blanked) while playing Pandora, you'll hear about 5-10 audio dropouts per minute. The only solution for the time being is to keep the screen active (I dim mine way down to minimum). Pandora IS aware
-
Signal drop after installing OS 4.0.1 - Apple 3GS 16GB
Hi, I have installed OS 4.0.1 yesterday and immediatly noticed drop in signal strength.Signal strength came to half after installing it. Any one else experiencing the same problem and any solution? I know I can go back to old version rather than that