string;# in dropdownlist - sharepoint

I made a custom dropdownfield. I want to display the full names of my contacts. I made a calculated column because not every user filled in their full name, only first and last. If I wanna show the items in my dropdown there is always string;# before my value. Does somebody know how to remove that?
Here is the code where i fill my dropdown
SPWeb web = site.OpenWeb();
SPDataSource dataSource = new SPDataSource();
dataSource.List = web.Lists["Contacts"];
this.testing.DataSource = dataSource;
this.testing.DataTextField = "Full Name";
this.testing.DataValueField = "Full Name";
this.testing.DataBind();
thx

The field type is probably "User" (I think shows as "People" in the UI). This and other lookup fields are always stored by SharePoint in this manner. The value component is the user ID and the string component is the user name.
You could use a Regex to split the components. You can also cast the value to SPFieldUserValue which is the 'proper' way, and use the properties on that class to retrieve info.

Assuming full name is a text field, it looks like you have an error in your calculated column definition related to one of your inputs being a lookup field.
If you can't get rid of it in a cleaner way, there's always substr (or maybe right, I can never remember the syntax for excel functions)

Related

change value of one field on the basis of other using spfx field customizer

I have a field name called Security(choice field) and other field name is Sensitivity. I want to copy the values of Security in Sensitivity in the list view. For example if value of security is Internal then in sensitivity column also it should show Internal in the list view only irrespective of the values stored in sensitivity. In laymen term Both field should show same values. I am new in spfx environment. Please help. I am using react framework. Let me know if you need any other details.
PS- I have 400k libraries consisting same column with same internal name so column formatting option is not suitable. we need o deploy as an extension so that it will change listview across all libraries.
In SPFx Field Customizer, implement the onRenderCell with below logic:
The method has signature as follows:
public onRenderCell(event: IFieldCustomizerCellEventParameters): void
Use below code to get the Security field value:
const securityValue = event.listItem["_values"].get("Security");
Once you get the item id, you can get the value of other field from same item.
Return the value as:
event.domElement.innerHTML = `<div>${securityValue}</div>`
Source: change value of one field on the basis of other using spfx field customizer

How to get view data to copy to field in document?

I'm currently tasked to redesign an application form where several fields will need to auto-fill based on the data from a specific field when it is entered.
Since I'm relatively new to LotusNotes, my boss hinted at me to first create a view which displays the fields to auto-fill. Which I did:
| Visitor Name | Company Name | Contact No | Date Entered |
Visitor Name is the field which will determine the data for Company Name and Contact No when it auto-fills in the form. Date Entered will see which data is the most recent and will use that. Also the field must be set as Editable to allow user to change the data if need be.
However, when trying to modify the form, I can't quite get how to link the view together with my desired field in the form.
I tried #DbLookup and created the formula
#If(VisitorName = "";"";VisitorName != ""; #DbLookup("" : "" ; "Local":"D:\LotusNotes Project\HR002a.nsf"; "Visitor View";#text(ContactName);#Text(CompanyName));"")
But it doesn't seem to work when I place it in Default Value or Input Translation. Even changing the filed to Computed doesn't seem to help as well.
What else am I missing in my formula?
You could simplyfiy your formula
#If(VisitorName != ""; #DbLookup("";#dbname;"Visitor View";#text(ContactName);2;[FailSilent]);"")
I am assuming this is a form used in the Notes clieny, not on the web. If this is a web form, you need a different approach.
You could very well use #DBLookup for that task. To improve performance, concatenate all the values into one column, perform the #DbLookup on the form, retrieving the concatenated values, then split them into separate values and populate the different fields.
You could also use Lotusscript. You want to look at the NotesView class and the NotesViewEntry class (assuming you want to build it for performance). Use the ColumnValues property of the NotesViewEntry class to read the columns in the view. Remember that the first column needs to be sorted.
Or your company could hire someone that already know Notes and Domino, and have that done in an hour. That would probably be financially a better choice than you spending hours or days on this fairly simple task. There are many of us here (me included) who could jump in and fix this for your company.

How to get items in a custom list using SuiteTalk

I want to set the value of a custom customer field. The field type is List/Record and the value must be from a custom list.
I believe I have to set the value to the internal ID value of the custom list item. The items look like this:
Am I right that I have to use the ID value? Instead could I set the customer field to the Value value?
Assuming that I have to set the customer field to the ID value, I want to load all the items into memory and then look up the ID by the Value, like this:
The problem is that I cannot work out how to download the items using SuiteTalk. I can use CustomListSearchBasic to get the custom list record:
But I can't seem to get the items in the custom list.
Please can you help? Also, I'd be delighted to know how to work this out for myself. The schema browser didn't help.
I worked it out. I needed to set searchPreferences.bodyFieldsOnly = false

Use list filter value when adding new items to list

In a webpart page I got a list that is filtered on a value given from another webpart.
When adding an item to that list (from this webpart page); is there a way to preset the column the list is filtered on to be the same as the filter value?
Thanks.
Ivar
this link describes how to pre-fill field based on a query string variable. It can be useful for you, and if you add some modification to this solution your problem should be solved. The thing is that when you come to the part where you create the parameter for the "New item form" web part, you'll not specify to be a query string parameter. Instead it should be of type "None", and after that when you make the connections between the webparts you'll connect them in a way that they pass parameters to each other, not filters. I had some similar problem recently and made it work out in this way.

How to Compute a Field in a Form from another Form or View in a Lotus DB

I have form "A" which there is a field that I need be computed after composed from Form "B". The forms are in the same database. I am not sure if it would be better to have the Form "A" field compute after composed from a "View" that uses the Form "B" or what would be the best way to get the field populated.
I have tried to do a #DBlookup, with no success.
Thank you!
Forms do not contain information, only documents do. Forms just represent information stored in documents.
Assume you have a view with name: "viewName" and it displays a set of documents.
The first sorted column of this view contains key values.
We want to get value of field someField by key from this view.
Create a new form, create a "Computed when composed" field and set the following formula as value:
#DbLookup("":"NoCache"; #DbName; "viewName"; "keyValue"; "someField");
It will access view "viewName" in the current database, get a document by "keyValue" and return value of field with name "someField"
I have tried to do a #DBlookup, with no success.
Well, what went wrong? Why didn't this work? When do you a #DbLookup call, you need to provide a view, a "key" and the field or view column you want to pull back from the matching document. Assuming you have a key with which you can link document A and document B, the look-up should be pretty straightforward.

Resources