Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7353 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm fairly new to 7, so please forgive me if the answer is obvious.

I have built a database and then a second to act as a UI. I have encountered a problem.

What I am trying to do is have the user log into the database with their full name. Let's use Joe Schmo. I have created an account called "Joe Schmo". What I am trying to accomplish is to auto enter into a field the account name - last name first. The result would be "Schmo, Joe". Here is the calc I'm trying to get to work

Name =

RightWords ( Get ( AccountName ) ; 1 ) & ", " & LeftWords ( Get ( AccountName ) ; 1 )

The calculation seems to work, but no matter what account I am logged in as, the result is always "Admin, Admin". As if I have logged in as the Admin account.

I can only guess that since the UI is accessing the data from another database, that maybe it is "logging in" to that data-only database as admin?

Or maybe my understanding of the Get (AccountName) function is incorrect?

Any help would be much appreciated.

Posted

Well, two things about being unstored.

1 - I need this to be an auto-enter calculation, cause I may need to change it from the original entry of the account name. I cannot find an option under the field option to not store

2 - I tried, just to see, to make new field called name test. Set it as a calulation field and put in the above calc. It did the same thing. No matter what account I was logged in as it resulted with "Admin, Admin"

Curious note. Wil troubleshooting I came across the Get ( UserName) function. When I tried this, It actually seemed to work. I got the account name that I was logged in as. However, when i went to test it under a different account, it continued to give the same name.

So maybe it did store the first result and that's what i keep getting? But I still cannot find a way to not store when aetting an auto-enter calculation. AND from what I read Get (AccountName) should work anyway.

Was a good try

Posted

From the sound of this, I think you want to record who created the record and who modified it. These can set in the auto entry, just as dates and times of creation and modification. In the autoenter dialog box clcik on creation and then choose either Name or Account Name. Do the same for modification. You could have a field Creation Name and another field Creation Account.

Posted

well. It's not quite that.. Let me explain in more detail.

think of it like a tech support database. I have 3 important fields that concern the account name. Called "Opened By" , "Call Assigned To", and "Call Closed By"

A call comes in, so the person who is logging the call creates a record. 9 times out of 10, he/she will be assigning the call to themselves. So, I would like both the "Call Opened By" and the "Call Assigned To" fields to have the currently logged in Account name auto entered in to them. This is just a convenience thing, but a nice one I think. Having this done in the auto-enter , rather then making the field a calulation, will allow the user to change that name in that 1 of out 10 time that they will assign it to someone else.

Here's the thing. The format. For reasons of design and preference the name fields in the database are all formated "LastName, FirstName". Our company formats all our logon names with "FirstName LastName", so I created the accounts to the database the same to make it easier on my users.

I would like to be able to use a calc to get the Account name, reformat it to "LastName, FirstName" and auto-enter it into the 2 fields.

But this is not the "Problem"

the problem is when using the Get (AccountName) function, it returns "Admin" no matter what account I am logged into the database on. So that is the only text I can get to work with. It simply does not give the account name of the account I am logged in as.

Again, I suspect it may have something to do with using a UI file the accesses the field info from another file, but I am no expert and am looking for advice or an explanation please.

Thanks again!

Posted

Duh.. well I answered my own question with the last line of that post.

I learned something new today. I have all my data in Database A. I made a UI database B that accesses the data.

It was indeed logging into Database B as "Joe Schmo" but the Get (AccountName) was returning with "Admin" BECAUSE database A was set to log in auto with admin. I didn't catch this, cause I assumed that since i was working in Database B, I was creating the Record in Database B, and Calling the Get (accountName) in Database B it would give me the name of the account logged into Database B. Well, it does not.

I guess because the field is defined in Database A, and the auto-enter calc is stored in Database A, that is where it went to resolve the Get ( AccountName).

I had to create accounts of the same name in both databases and uncheck the auto login and that fixed things for me. Now it works as I wanted it to.

I still think it's wierd. Everything I learned so far about FMP7 is that it reacts to where you are in the databse. But this is opposite that. Well, I'm still learning. smile.gif

Thanks everyone, and thanks Ralph for the suggestions.

This topic is 7353 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.