Fetch Unique name for a userid column in splist

Hi,
I have a requirement. In my splist, I having a column named userid which is a user type column and it repeats multiple times.
Now, as I have created a web part which lists the "Name" column in a gridview based on the filtering.teh filtering rules is :
1) Fetch the current logged in user
2) Check whther the current logged in user's id present in this splist's UserId column.
3) If yes, I need to fetch the Name column for that row and come out of the loop
note: i didnt use CAML here.
Now, My issue is, though i  fetched this column,i am getting multiple entries of this userid.
I want to get the unique entry -[ i mean,  currentloggeduserid==UserId value of the column ]. i think  is there any way, i can get the Distinct entry of "Name" column/value by matching the userid. when i ran the below code,
i am getting multiple "Name" columns for the currentloggedinuser value.
but I need one and only one "Name"  column.
may i know  how to perform this.
should i apply join for this.
help is appreciated!
if (mlist != null && mlist.Items.Count > 0)
foreach (SPListItem oneitem in mlist.Items)
string[] character = { "\\" };
if (oneitem["UserID"] != null && !string.IsNullOrEmpty(oneitem["UserID"].ToString()) && varCurrentLoggedinUser != null)
string[] userName = oneitem["UserID"].ToString().Split(character, System.StringSplitOptions.None);
varCurrentUser = userName[1].ToString();
_mName = mWeb.Title.ToString();
if(varCurrentUser.Equals(varCurrentLoggedinUser))
isblnCurrUserin = true;
else
isblnCurrUserin = false;
if (isblnCurrUserin.Equals(true))
Dr1 = dt1.NewRow();
dr1[NAME] = _mName;
dt1.Rows.Add(dr1);
break;

Try this. My suggested changes are italic and underlined.
if (mlist != null && mlist.Items.Count > 0)
                                                        foreach (SPListItem oneitem in mlist.Items)
                                                            string[] character = { "\\" };
                                                            if (oneitem["UserID"] != null &&
!string.IsNullOrEmpty(oneitem["UserID"].ToString()) && varCurrentLoggedinUser != null)
                                                                string[] userName = oneitem["UserID"].ToString().Split(character,System.StringSplitOptions.None);
                                                                varCurrentUser = userName[1].ToString();
                                                                _mName = mWeb.Title.ToString();
                                                                if(varCurrentUser.Equals(varCurrentLoggedinUser))
isblnCurrUserin = true
Dr1 = dt1.NewRow();
dr1[NAME] = _mName;
dt1.Rows.Add(dr1);
break;
                                                                else
                                                                    isblnCurrUserin = false;
if(isblnCurrUserin)
break;
Nilesh S. Pawar

Similar Messages

  • How to get LR using unique names for each file?

    Hey there,
    I see LR does modify the name of the File when there is already one file with the same name in the folder of import, but once you choose a different folder it does import the File with the original name. I just realized that over the years using Folders such as Pictures 2009, Pictures 2010 and so on, I have three or four times Files with the same Name. Is there a way to tell LR to always use unique names when it imports?

    Use a date-description-sequence.ext naming template for renaming as you import [or if you prefer after you import]. This means you never have duplicates unless you for some bizarre reason use same name description for two sets of files on same day. And if you need to do just that, simply make the start number of second/third lot of files be one number greater than previous batch from same day.
    You can set up what ever naming format you desire in file rename dialogue and have that as your default.
    Leaving files names as they come out of the camera is asking for big trouble as invariably they will duplicate, which is not a good idea even if in different folders.
    F2 gets you renaming dialogue when in Library.

  • How to give alias name for group of columns.

    the below is the query to get Columns. But, i need to make single alias name to all the column which i get. I need to get column names also event, domain, entity, bpdid. Above columns should be under single alias name like 'baseMessage'. Please advise on this.
    select (select decode(ICKD_CHR_KY1_ID,'I','New','D','Cancelled','U','Modified') from ICKD where ICKD_APLN_ID = 'CSTCOM' and ICKD_NUM_KY1_ID = 1438227010) event, 'Client' domain, 'CustomerCommunication' entity, 'General' scope, (select ICKD_NUM_KY6_ID from ICKD where ICKD_NUM_KY1_ID = 1438227010 and ICKD_APLN_ID = 'CSTCOM') bpdId from dual;

    ; WITH CTE AS (
        SELECT Case When  sum(b.targetTotal) > 0 then  Sum(b.targetTotal)  
                          else 0
               end as Profttarget,
               Case When  sum(a.salestotal) > 0 then  Sum(a.salestotal)  
                          else 0
               end as Sales,
               Case When  sum(a.salescost) > 0 then  Sum(a.salescost)  
                    else 0
               end as SalesCost
        From  Sales A
        JOIN  Target B A.salesdate = B.salesdate
    SELECT Profttarget- ( Sales - SalesCost ) as TargetRequired
    FROM   CTE
    This gives you a query that runs in SQL Server.
    But it does not look right to me. I don't know what the keys of these tables are, but is it really salesdate in both? And even if it is, the join still looks strange.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Need to know base table and base column name for Oracle view columns

    I am trying to load metadata for some views and that requires me to know what the final table and column name would be corresponding to the view column.
    For example, if I have a view x_v that is select a,b from x_v2; and x_v2 is a view that is select a,b,c from x;
    I need to get the following information.
    View View Col Base Table Base Col
    X_V A X A
    X_V B X B
    and so on.
    Is it possible to get this programmatically using any SYS schema tables or Dependency tables?
    I tried an indirect approach wherein I lock tables using LOCK TABLE or FOR UPDATE OF. But I'm not too sure if I can go down to the level of individual view columns.
    Can you help me with this?

    Thanks. I was looking at some indirect approaches.
    I came up with this script that does it faster than dependencies but thats just for tables and not column mapping.
    declare
    cursor bt(cp_sid number) is
    select u.name uname, o.name oname
    from sys.obj$ o, sys.user$ u
    where o.obj# in (select id1
    from v$lock
    where sid=cp_sid)
    and u.user# =o.owner#;
    cursor c_sid is
    select sid
    from v$session
    where audsid =userenv('sessionid');
    l_sid number;
    l_view varchar2(100):= 'PER_PEOPLE_V';
    l_schema varchar2(10):= 'APPS';
    begin
    open c_sid;
    fetch c_sid into l_sid;
    close c_sid;
    dbms_output.put_line('SID: '||l_sid);
    execute immediate 'lock table '||l_schema||'.'||l_view||' in row share mode nowait';
    for i in bt(l_sid) loop
    dbms_output.put_line(i.uname||'.'||i.oname);
    execute immediate 'alter table '||i.uname||'.'||i.oname||' disable table lock';
    execute immediate 'alter table '||i.uname||'.'||i.oname||' enable table lock';
    end loop;
    end;
    It basically uses locks on views to verify locks on the base tables.
    Just wondering, can we use FOR UPDATE OF statements to get to the columns?

  • Creating unique names for virtual copies

    I utilze three different sets of images for most jobs: the raws, the thumbnails I upload for client review and the jpgs I send out for prints. I like to match the filenames so there is no confusion.  Unfortunately my gallery (smugmug pro) also assigns a unique # to each upload.  When I use virtual copies to ceate alternate versions of certain images they are named copy 1 or copy 2 in LR and the preceding # is dropped from the sequence, so when I upload the thumbnails, the gallery #s no longer match the filename # below. I always instruct my clients to ordeer selections from the filename but enough of my retail clients have become confused that it is becoming irritating. So I was wondering if there is a way to overide the LR presets and assign individual names to the virtual raws and the jpgs?

    OK You are confusing the file name with the SmugMug URL. When you publish to SmugMug you are exporting a new jpeg so your virtual copy is irrelevant unless you have a method of linking it with what your client is viewing. That probably means not changing the original camera file except for the number of different edits you make; which Lightroom does automatically.
      

  • How to get domain name for the userId?

    There is a generic way to get userID
    System.getProperty( "user.name" ).
    In case of windows it's a name you login in.
    Is any way in Java to figure out domain name of that particular user by Java code?
    Igor

    You can dojava.net.InetAddress.getLocalHost().getHostName()to get the name of the computer. But this will not give you the "domain name of the user". In Windows, for example, when I sign on to my computer, that user name only means something to my computer. There's no "domain", in the Internet sense, involved.

  • The resource name is already in use. You must select a unique name for the resource.

    I am using Project Server 2010 PWA.
    I have created resource of type 'Work' in Resource Center. Server Settings -> Resource Center. Click
    New Resource. I already assigned few task to these Resources.
    Now I want these Resources can login into PWA site. I tried to add New User from Server
    Settings -> Manage user. But I am unable to do so as I am getting the
    error message: The
    resource could not be saved due to the following reasons:The resource account is already in use. (unchecked "User
    can be assigned as a resource" checkbox doesn't solve)
    I am using forms-based
    authentication. From Resource Center I tried Edit
    Resource but we does not have any option there to give Windows User Account. 
    I do not want to delete the resource and re-create. Is there any way by which I can give
    Windows User Account to my existing resources?

    Hi,
    You should edit fhe existing resource from the resource center, check the option "the resource can connect to Project Server" and set a valid user account.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • Error message when trying to create a unique name

    Why do I keep getting an Error message when trying to create a unique name for a location on your site. I am simply looking to use your free 2GB space to store some pics and vids but keep getting an error message.

    How come Leopard let me use the WGM in standard mode?
    While SA complains that it won't work in Standard Configuration, WGM does not. There is some fault in the logic of this for which I don't have an explanation.
    If I want to get control on Dock, selection of Home folder, config of Proxy... which I think are basic things, do I really need the advanced mode?
    If you wish to have complete control of all client settings, yes. There really is no disadvantage of using an Advanced configuration other than the learning curve.
    So if I switch to advanced mode, there is good chance I won't get this error message anymore, right?
    Yes.

  • Create multiple instances of same class but with unique names

    Hi,
    I'm creating an IM application in Java.
    So far I can click on a user and create a chat session, using my chatWindow class. But this means I can only create one chatWindow class, called 'chat'. How can I get the application to dynamically make new instances of this class with unique names, for examples chatWindowUser1, chatWindowUser2.
    Below is some code utlising the Openfire Smack API but hopefully the principle is the clear.
        private void chatButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          
            int selectedUserIndex = rosterList.getSelectedIndex();
            String selectedUser = rostAry[selectedUserIndex].getUser();
            System.out.println("Chat with: " + selectedUser);
            if (chatBox == null) {
                JFrame mainFrame = CommsTestApp.getApplication().getMainFrame();
                chatBox = new CommsTestChatBox(mainFrame,conn,selectedUser);
                chatBox.setLocationRelativeTo(mainFrame);
            CommsTestApp.getApplication().show(chatBox);
    }  

    yes, an array would work fine, just realize that by using an array, you're setting an upper bound on the number of windows you can have open.
    As for unique names, if you mean unique variable name, you don't need one. The array index serves to uniquely identify each instance. If you mean unique title for the window, set that however you want (username, index in array, randomly generated string, etc.). It's just a property of the window object.

  • Using Alias for the table column

    Dear all,
       Can we use alias name for the table column while developing zreport.
    ie.,
      without using standard  table column name ( like mara-matnr ), i wish to use mat_num for matnr. So that, one can easily understand the column.
    Could you help me out in this regard.
    Thanks in Advance,
    S.Sridhar.

    yes you can declare in ur internal table like
    material_number like mara-matnr.

  • How To Get Attribute Names for a Particular VO

    Hi ,
    How To Get Attribute Names Of a Vo where I can Set Viewattributname To the Table RN Columns Where I am Adding Extra Columns Based on Some Condn..
    So wen i am creating new Column to existing Table RN and we Need to add Attribute Name Also...Rt..
    And How To get RelationShip Between Database Column Name and Java Vo Attribute Name
    Ex: PlanId is the Java VO Attribute Name for the Database Column PLAN_ID
    In The Same way Hw We Get the Relation ship for All other columns In the Controller Cllass ..
    Can Any One Reply as It is urgent Req...
    Thanks ,,
    Jithen

    Instead of using the VO attribute names to set and get values, best to go to the VO definition, click on Java, and generate the View Row Class with the accessors.
    In the class where you're trying to set attributes, instead of a Row class, use the View Row class of your VO (eg ViewObjectName's class would be ViewObjectNameRowImpl), and when retrieving a row from the VO, cast the row to the previously mentioned View Row Class.
    At that point you can use the View Row Class's methods that would perform sets and gets of each column.
    To get attribute names, I don't know off the top of my head, but there might be a method mentioned in the Javadoc for the ViewRowImpl or ViewObject or ViewObjectDefinition classes to get the attribute/column mapping, or perhaps you can somehow read the XML definition of the VO which has that mapping.
    Assuming business components were built automatically and no attribute names were overridden, intuitively the attribute name is a camelcase version of the column name, removing understores and capitalizing the character following the removed underscore - but that's not a fool proof approach. Just a general observation.
    Hope this helps.
    Edited by: user6631964 on Sep 16, 2010 12:31 PM

  • How to get Unique calid for users with same name in multiple domain env..

    I found we need to use "-k legacy" option for creating users in non-hosted setup..
    I had two domains default as xxxx.com and the one that I created as yyyy.com
    When I have users with same name in two of the domains as user1..
    The calid for both of them is... user1 ....so they share the same calendar
    When Im in valid SSO of yyyy.com I get the mail account for user1 as [email protected] .....but the calid .. common as user1
    How I can get unique calid for users under two domains..
    whether I need to set Hosted domain support...Then how the mailid's differ with out using hosted domain support..
    And I need to login UWC without using @domain.com...
    Help me on this...
    Ashik

    Do you have UWC and Cal configured at least for virtual domain support?
    basically.. for discussion.. let's say you have three domains on your server.. 1st domain is the default domain. other 2 domains are virtual domains.
    if all domains were created with mail and cal support (-S mail,cal).. you would use the following options when creating users:
    1) for the default domain.. you must use the "-k legacy" option when adding users.
    2) for the other two domains.. when you create the user.. do NOT use a "-k" option.
    If you do not use the "-k" option.. it defaults to "hosted" which will cause the user's calid to be [email protected]
    If you Do use the "-k legacy" option.. it will create the calid as just "userid"
    With regard to logging into UWC without the @domain.com part of a username in a hosted domain.. the easiest way to avoid this.. is to point a host name under the hosted domain to the server.
    if you point webmail.xxxx.com to the server... and then access it via:
    http://webmail.xxxx.com/uwc/
    any users in the xxxx.com hosted domain will NOT need to use @xxxx.com when logging in... they can just use "userid"
    This feature does not take any special configuration (aside from adding a DNS entry for the hosted domain)
    Hopefully that helps.

  • How to get unique Batch Name for AP Open Interface Import Program

    Hi,
    We have enabled the invoice batch controls i.e. the profile option 'AP: Use Invoice Batch Controls' set to Yes.
    We have an interface with some system from where we receive a data file that has AP invoices. The invoices are loaded into staging table, and finally into AP invoice interface tables. After this the AP Open interface import is run.
    The relevant programs are in a concurrent request set and are executed every day.
    The issue is with the 'Batch Number' parameter of the Payables Open Interface Import Program. If I enter some text as the batch number, the Batch gets created with that name only. As such we need the Batch number to be unique for each job run.
    Oracle help says "If the AP: Use Invoice Batch Controls profile option is enabled and if you provide no value for this parameter then the system provides a value for you. The value the system provides is the concatenation of the Source and a unique sequential number. For example, ERS: 1234".
    However the problem is the Batch Name Parameter is mandatory, and cannot be left NULL.
    Has any one faced this issue earlier? Am I missing any setup or step?
    Any inputs in this regard would be highly appreciated!
    Best regards,
    Anand

    The proper Oracle suggested method would be to put a wrapper program around your request set that determines the batch name.
    The easier (abet less supported) method:
    CREATE OR REPLACE TRIGGER custom.coop_ap_batches_all_insert
    BEFORE
    INSERT
    ON ap.ap_batches_all
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    -- to update batch name...
    -- created so that the nightly batches can have unique names by date
    -- nightly batches will be created with their simple name
    -- IE VIR, DI, MI, etc... this trigger will rename them
    -- to YYYY-MM-DD-VIR, YYYY-MM-DD-DI, YYYY-MM-DD-MI, etc...
    IF LENGTH(TRIM(:new.batch_name)) < 4 THEN
    :new.batch_name := TO_CHAR(SYSDATE,'YYYY-MM-DD') || '-' || :new.batch_name;
    END IF;
    :new.batch_name := UPPER(:new.batch_name);
    END;
    /

  • How to get column names for a specific view in the scheme?

    how to get column names for a specific view in the scheme?
    TIA
    Don't have DD on the wall anymore....

    or this?
    SQL> select text from ALL_VIEWS
      2  where VIEW_NAME
      3  ='EMP_VIEW';
    TEXT
    SELECT empno,ename FROM EMP
    WHERE empno=10

  • What are the userid,password, and host name for oracle 9i?

    HI Guys.
    I am a research student at the University and the I recently downloaded Oracle 9i for my research. But the problems is also with seting it up. Please could you show me the userid, password, and host name for oracle 9i.
    Thanks in advance for your cooperations.
    Malinga R
    [email protected]

    I believe that starting with 9.2, you have to specify different passwords when you install (can't be the default).
    Justin

Maybe you are looking for

  • Balance trasnfer from old spl G/L account to New spl G/L account

    Hi, We need to transfer the balance from old spl G/L to new spl G/L, please note these spl G/L are mapped to Reconciliation accounts. What is best way or practice for doing this activity? we need to transfer balances of only spl G/L and not the recon

  • Unable to relay audio to AirPlay speakers VIA AppleTV.

    Hi, So I just bought a Pioneer SMA4 Airplay speaker, which in itself is working perfectly (amazing sound BTW); - iPhone > Spotify/AirPlay audio/video to > Pioneer: Check - Mac > iTunes audio to > Pioneer: Check - AppleTV2 > AirPlay audio/video to > P

  • Using my MacBook in Japan

    Hi, I live in the UK and bought my MacBook here. I need to take it for work purposes to Japan and was wondering if it will be okay to use the power adapter on their mains (obviously I will have to buy and adapter for the plug but it is the Voltage an

  • I am not seeing all the categories in iBook app.

    I am not seeing all the book categories. I am seeing only biography, history, religion and travel categories. Also I think I can see only the free books. Others books do not show up in the search. Do I need to do any settings?

  • Is there a way I can create a playlist for my TV Shows purchased from iTunes?

    Hi Guys, Recently upgraded to IOS7 and my video app has changed. I use the ipad in the car for my daughter and play a series of pepper pig continuously. However, with the new upgrade the option to play all epps in folder is not there anymore, it only