Member formula - Account Type

BabuJayaraman
New Contributor II

I have an issue with the member formula with the below condition. It checks for Account Type Revenue or Expense. However if the Account Type is Revenue or Expense, still the condition is not met. Is there any issue with the way the condition is written?

If api.Account.GetAccountType(api.pov.account.memberid).Equals("Expense") _
Or api.Account.GetAccountType(api.pov.account.memberid).Equals("Revenue") Then

  Return 1

End If

2 ACCEPTED SOLUTIONS

Alternatively, you could use this below:

If api.Account.GetAccountType(api.Pov.Account.MemberId) = AccountType.Revenue OrElse api.Account.GetAccountType(api.Pov.Account.MemberId) = AccountType.Expense Then

View solution in original post

RobbSalzmann
Valued Contributor

Hi @BabuJayaraman , 
You are close. Try this:

Dim acctTypePov As AccountType = api.Account.GetAccountType(api.pov.account.memberid)
Dim isIncStmtAcct As Boolean = 
	acctTypePov.Equals(AccountType.Expense) OrElse
	acctTypePov.Equals(AccountType.Revenue)

If isIncStmtAcct Then
	Return 1
End If

 

View solution in original post

5 REPLIES 5

Omkareshwar
Contributor II

In your call you are getting the account type object, and you need to use the name property of that object to check for account type name.

This should work  

If api.Account.GetAccountType(api.pov.account.memberid).Name.XFEqualsIgnoreCase("expense") Or
api.Account.GetAccountType(api.pov.account.memberid).Name.XFEqualsIgnoreCase("Revenue") Then

End If

 

 

Thanks, Omkareshwar
Archetype Consulting

CarlosAlvear
Contributor

Hi Babu,

To complement Omkareshwar's answer, an image of the AccountType object that you can find after clicking in "Objects"

Good luck.

Carlos

Raevla_2-1705582408338.png

 

Raevla_0-1705581981492.png

 

Alternatively, you could use this below:

If api.Account.GetAccountType(api.Pov.Account.MemberId) = AccountType.Revenue OrElse api.Account.GetAccountType(api.Pov.Account.MemberId) = AccountType.Expense Then

Michel_Sabourin
Contributor II
This is what I use as part of a process I do to create a "traditional" trial balance for a few clients. This works for me.
 
Dim povAcct As Integer = api.Pov.Account.MemberId
Dim povAcctType As AccountType = api.Account.GetAccountType(povAcct)
 
If povAcctType.Name = "Asset" Or povAcctType.Name = "Expense" Then
Return 1
Else
Return Nothing
End If

RobbSalzmann
Valued Contributor

Hi @BabuJayaraman , 
You are close. Try this:

Dim acctTypePov As AccountType = api.Account.GetAccountType(api.pov.account.memberid)
Dim isIncStmtAcct As Boolean = 
	acctTypePov.Equals(AccountType.Expense) OrElse
	acctTypePov.Equals(AccountType.Revenue)

If isIncStmtAcct Then
	Return 1
End If