Faire apparaître un champs dans une colonne "Valeur Calculée"
1 réponse
Eric
Bonjour à tous!
J'ai sps2003 et sql server 2000
Quelqu'un pourrait-il me dire comment faire pour ajouter dans une
colonne "Valeur Calculée" , le ID de l'item que j'ajoute dans ma liste
personnalisée concaténé avec un texte. Par exemple:` Quand j'ajoute un
nouvel élément à ma liste, je veux lorsque je sauvegarde mon nouvel élément,
qu'il m'affiche dans la colonne X (valeur calculéé) ceci "PR-1" où 1
équivaut au numéro ID et ainsi de suite à chaque fios que j'inscrit un
nouvel élément.
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
EROL [MVP SPS]
Bonjour,
Lire: cette article
SharePoint: Creating a Calculated Column for Text instead of Numbers and using it for Lookups Ok, by now everyone has realized you can use calculated columns for numerical values but did you know you can use it for your text fields as well? Well, if you didnt know... now you do! :)
Let's say you want to create a new list to contain notes about people in your contacts list... So basically, you would create a lookup field to your Contacts list. Easy Right? Well normally, Yes but you were too lazy to fill out the "Full Name" field. So, you can't really do a lookup to "Last Name" because you have 18 people with the last name of "Davis" and using the "First Name" column is certainly out of the question. So what do you do?
Part 1.
Well, what you can do is go back into your Contacts list and created a new calculated column called "FullName_calc" with the purpose of joining your "First Name" (text) and "Last Name" (text) fields. Now, here's where the Coders and Application users can take separate paths....
I am application user and am familiar with Excel so I always refer to Excel formulas when I do my calculated columns but if you come from a coding background you can also use VB to accomplish this task. Here's the two examples:
Using my Excel background: =CONCATENATE([Last Name],", ",[First Name])
Resulting Output for Both is a New Calculated Column: Doe, John
Part 2.
Ok, now the sucky part. You can't do a lookup to a calculated field :( ...I know it stinks! Believe me, I said the same thing and worse! However, the work-around I have found is to create another new field in you Cotacts list called "FullName_text". Now go back to your Contacts list and go to the Edit in Datasheet View (I love this view for entering data). Now what you want to do is click the column heading of your "FullName_calc" column so that the entire column is selected. Click "CTRL+C" to copy... Select the column heading of "FullName_text" so that the entire column is selected and click "CTRL+V" to paste. You now have a column, you can do a lookup to without having to type the Full Names of every user in your contacts list. All that's left is to remove the unecessary calculated column and rename your "FullName_text" to something prettier :)
Closing Comments Well, it wasn't exactly pretty and we're dealing with some limitations of SharePoint but we got the job done with the least amount of time and work possible. Good Luck! I hope this article helped out! If you liked it or used it, please leave me feedback... I'd like to hear. Thanks!
-Mark
+++++++++++++++++
EROL
http://sharepointerol.blogspot.com/
"Eric" a écrit dans le message de news: %
Bonjour à tous!
J'ai sps2003 et sql server 2000
Quelqu'un pourrait-il me dire comment faire pour ajouter dans une colonne "Valeur Calculée" , le ID de l'item que j'ajoute dans ma liste personnalisée concaténé avec un texte. Par exemple:` Quand j'ajoute un nouvel élément à ma liste, je veux lorsque je sauvegarde mon nouvel élément, qu'il m'affiche dans la colonne X (valeur calculéé) ceci "PR-1" où 1 équivaut au numéro ID et ainsi de suite à chaque fios que j'inscrit un nouvel élément.
Merci
Bonjour,
Lire: cette article
SharePoint: Creating a Calculated Column for Text instead of Numbers and
using it for Lookups
Ok, by now everyone has realized you can use calculated columns for
numerical values but did you know you can use it for your text fields as
well? Well, if you didnt know... now you do! :)
Let's say you want to create a new list to contain notes about people in
your contacts list... So basically, you would create a lookup field to your
Contacts list. Easy Right? Well normally, Yes but you were too lazy to fill
out the "Full Name" field. So, you can't really do a lookup to "Last Name"
because you have 18 people with the last name of "Davis" and using the
"First Name" column is certainly out of the question. So what do you do?
Part 1.
Well, what you can do is go back into your Contacts list and created a new
calculated column called "FullName_calc" with the purpose of joining your
"First Name" (text) and "Last Name" (text) fields. Now, here's where the
Coders and Application users can take separate paths....
I am application user and am familiar with Excel so I always refer to Excel
formulas when I do my calculated columns but if you come from a coding
background you can also use VB to accomplish this task. Here's the two
examples:
Using my Excel background:
=CONCATENATE([Last Name],", ",[First Name])
Resulting Output for Both is a New Calculated Column:
Doe, John
Part 2.
Ok, now the sucky part. You can't do a lookup to a calculated field :(
...I know it stinks! Believe me, I said the same thing and worse! However,
the work-around I have found is to create another new field in you Cotacts
list called "FullName_text". Now go back to your Contacts list and go to
the Edit in Datasheet View (I love this view for entering data). Now what
you want to do is click the column heading of your "FullName_calc" column so
that the entire column is selected. Click "CTRL+C" to copy... Select the
column heading of "FullName_text" so that the entire column is selected and
click "CTRL+V" to paste. You now have a column, you can do a lookup to
without having to type the Full Names of every user in your contacts list.
All that's left is to remove the unecessary calculated column and rename
your "FullName_text" to something prettier :)
Closing Comments
Well, it wasn't exactly pretty and we're dealing with some limitations of
SharePoint but we got the job done with the least amount of time and work
possible. Good Luck! I hope this article helped out! If you liked it or
used it, please leave me feedback... I'd like to hear. Thanks!
-Mark
+++++++++++++++++
EROL
http://sharepointerol.blogspot.com/
"Eric" <ecote@garant.com> a écrit dans le message de news:
%232ySb6j0EHA.1292@TK2MSFTNGP10.phx.gbl...
Bonjour à tous!
J'ai sps2003 et sql server 2000
Quelqu'un pourrait-il me dire comment faire pour ajouter dans une
colonne "Valeur Calculée" , le ID de l'item que j'ajoute dans ma liste
personnalisée concaténé avec un texte. Par exemple:` Quand j'ajoute un
nouvel élément à ma liste, je veux lorsque je sauvegarde mon nouvel
élément,
qu'il m'affiche dans la colonne X (valeur calculéé) ceci "PR-1" où 1
équivaut au numéro ID et ainsi de suite à chaque fios que j'inscrit un
nouvel élément.
SharePoint: Creating a Calculated Column for Text instead of Numbers and using it for Lookups Ok, by now everyone has realized you can use calculated columns for numerical values but did you know you can use it for your text fields as well? Well, if you didnt know... now you do! :)
Let's say you want to create a new list to contain notes about people in your contacts list... So basically, you would create a lookup field to your Contacts list. Easy Right? Well normally, Yes but you were too lazy to fill out the "Full Name" field. So, you can't really do a lookup to "Last Name" because you have 18 people with the last name of "Davis" and using the "First Name" column is certainly out of the question. So what do you do?
Part 1.
Well, what you can do is go back into your Contacts list and created a new calculated column called "FullName_calc" with the purpose of joining your "First Name" (text) and "Last Name" (text) fields. Now, here's where the Coders and Application users can take separate paths....
I am application user and am familiar with Excel so I always refer to Excel formulas when I do my calculated columns but if you come from a coding background you can also use VB to accomplish this task. Here's the two examples:
Using my Excel background: =CONCATENATE([Last Name],", ",[First Name])
Resulting Output for Both is a New Calculated Column: Doe, John
Part 2.
Ok, now the sucky part. You can't do a lookup to a calculated field :( ...I know it stinks! Believe me, I said the same thing and worse! However, the work-around I have found is to create another new field in you Cotacts list called "FullName_text". Now go back to your Contacts list and go to the Edit in Datasheet View (I love this view for entering data). Now what you want to do is click the column heading of your "FullName_calc" column so that the entire column is selected. Click "CTRL+C" to copy... Select the column heading of "FullName_text" so that the entire column is selected and click "CTRL+V" to paste. You now have a column, you can do a lookup to without having to type the Full Names of every user in your contacts list. All that's left is to remove the unecessary calculated column and rename your "FullName_text" to something prettier :)
Closing Comments Well, it wasn't exactly pretty and we're dealing with some limitations of SharePoint but we got the job done with the least amount of time and work possible. Good Luck! I hope this article helped out! If you liked it or used it, please leave me feedback... I'd like to hear. Thanks!
-Mark
+++++++++++++++++
EROL
http://sharepointerol.blogspot.com/
"Eric" a écrit dans le message de news: %
Bonjour à tous!
J'ai sps2003 et sql server 2000
Quelqu'un pourrait-il me dire comment faire pour ajouter dans une colonne "Valeur Calculée" , le ID de l'item que j'ajoute dans ma liste personnalisée concaténé avec un texte. Par exemple:` Quand j'ajoute un nouvel élément à ma liste, je veux lorsque je sauvegarde mon nouvel élément, qu'il m'affiche dans la colonne X (valeur calculéé) ceci "PR-1" où 1 équivaut au numéro ID et ainsi de suite à chaque fios que j'inscrit un nouvel élément.