rameshmusham
Scout

Re: Populate fields based on Current User

Jump to solution
if(cv_CurUserPreferredName && isNullOrEmpty(llu_Western_Employee),lookup("/ASP/PMO/AdminWebDB|tbl_Westerners","LastName","FullName",cv_CurUserPreferredName,'FirstName'),lookup("/ASP/PMO/AdminWebDB|tbl_Westerners","LastName","FullName",parseLookup(llu_Western_Employee),'FirstName'))

I see that you added LastName in the formula which is not required, as we are filtering based on fullname from the second list - you can use the below formula

if(cv_CurUserPreferredName && isNullOrEmpty(llu_Western_Employee),lookup("/ASP/PMO/AdminWebDB|tbl_Westerners","FullName",cv_CurUserPreferredName,"FirstName"),
lookup("/ASP/PMO/AdminWebDB|tbl_Westerners","FullName",parseLookup(llu_Western_Employee),"FirstName"))

and let me know the results. The single or double quotes doesn't matter.

0 Kudos
Reply
kelliganp
Scholar

Re: Populate fields based on Current User

Jump to solution

Hi @rameshmusham,

I was not able to get the use case working on my primary test project that I posted from previously. Instead, I strated from scratch to see if I could get your exact use case built on my site wothout referrencing another site. I think I got it to work for the most part. My only problem is that the values do not show uop in the actual text fields until it is submitted and reopened.

AP0000.png

The following is before submission...

AP0003.png

 

...and this is after submission

AP0001.png

 

Can you tell me what I am missing?

0 Kudos
Reply
rameshmusham
Scout

Re: Populate fields based on Current User

Jump to solution

May i know the reason why you are using the text fields to save the data again from calculated column's?

0 Kudos
Reply
kelliganp
Scholar

Re: Populate fields based on Current User

Jump to solution

@rameshmusham wrote:

May i know the reason why you are using the text fields to save the data again from calculated column's?


Well this is awkward. Because that is the way I have always done it. Smiley Wink
I started creating forms in InfoPath originally and that is how I was taught to do it. Please help me understand why I should not.
I do need to store the data in the list but I suspect if I connect/bind the calculated controls to the list columns that would have the same effect as long as I do not allow the calculated controls to recalculate after submission.


A couple of other questions on this theme... In your use case, the fields looked like text fields with the white background (one of the reasons I thought you were using regular text fields). Is there something you are doing different in your use case that I am not catching on to?
Also, you use the term calculated column. Is that the same as using a calculated control or is it something different?


Thanks for all of you input and assistance!
Patrick

0 Kudos
Reply
rameshmusham
Scout

Re: Populate fields based on Current User

Jump to solution

In general i use calculated columns to be connected to list columns to update the list. I tried my best and i have a workaround to update the text box by clicking on it:

jsvarfname is for textbox

jsvarfirstname is for calculated column.

 

NWF$(document).ready(function(){
NWF$("#"+jsvarfname).click(function(){
NWF$("#"+jsvarfname).val(NWF$("#"+jsvarfirstname).val());
});
});

0 Kudos
Reply
kelliganp
Scholar

Re: Populate fields based on Current User

Jump to solution

Thanks @rameshmusham ! I got your Use Case working in my work probelm! This will change the way I do things moving forward as most of my projects require auto-populate.


@rameshmusham wrote:

...I tried my best and i have a workaround to update the text box by clicking on it:

jsvarfname is for textbox

jsvarfirstname is for calculated column.

 

NWF$(document).ready(function(){
NWF$("#"+jsvarfname).click(function(){
NWF$("#"+jsvarfname).val(NWF$("#"+jsvarfirstname).val());
});
});


I will play with this code and see if I can make it work.

 

Thanks and Regards,

Patrick

0 Kudos
Reply