Skip to main content
Solved

Using Attributes in formulas within a field


jesuscruz97
Jr Varsity II

Hi: 

I'm trying to create a GI of Invoiced Items, but I want to separate the items by an attribute.  The GI is going to be summarized by Sales Rep and the Sales would be in 3 Columns. Attribute1 Value1, Attribute1 Value2 and Attribute1 Value 3. 

I create a formula like: =IIf( [InventoryItem.COMI_Attributes]='VO5', [ARTran.ExtPrice], 0.00), it validates. 

 

but when I run the GI I got this error. 

Error: The virtual field COMI_Attributes cannot be used in a condition expression.

 

How can I get my GI to work. 

 

Thanks 


Jesus.

 

Best answer by mikeho

Thanks, @Django! I joined them by the NoteID/RefNoteID and then added a relation so that CSAnswers.attributeID = ‘[AttributeID I need to use in a formula]’ and that worked perfectly.

View original
Did this topic help you find an answer to your question?

16 replies

Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • April 4, 2023

I’ve run into the same issue - trying to use an Attribute in a formula in a GI and getting the same error message. Hoping someone can help provide direction!


Forum|alt.badge.img+6
  • Captain II
  • 576 replies
  • April 5, 2023

One way would be to join the CSAnswers table into your GI. That’s where the attributes live. Then you’ll be able to use the value from CSAnswers in your formula.


Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • April 5, 2023

@Django - How would you suggest joining the CSAnswers table to the Vendor table (for which I have my attribute I’m trying to use in a formula)? I’ve tried the below join as well as by attributeID_description and neither of those worked.

 

 


Forum|alt.badge.img+6
  • Captain II
  • 576 replies
  • April 5, 2023

You connect to CSAnswers using the NoteID from the parent table (in your case from the Vendor table) to the CSAnswers.RefNoteID field.  Then filter on the CSAnswers.AttributeID for the attribute that you’re interested in. 

This will give you a one to many join condition so you might have to play with conditions and filters if the addition of that table impacts your output.


Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • Answer
  • April 5, 2023

Thanks, @Django! I joined them by the NoteID/RefNoteID and then added a relation so that CSAnswers.attributeID = ‘[AttributeID I need to use in a formula]’ and that worked perfectly.


K2a
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 92 replies
  • May 5, 2023
mikeho wrote:

Thanks, @Django! I joined them by the NoteID/RefNoteID and then added a relation so that CSAnswers.attributeID = ‘[AttributeID I need to use in a formula]’ and that worked perfectly.

Any interest in sharing a screenshot?!   I have been trying to accomplish this just reading the descriptions and it’s not happening.  Cheers!


Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • May 6, 2023

@K2a - sure, no problem.

Here’s the Relation I used:

 

Where VEND3PAZ is the Attribute ID:

 


K2a
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 92 replies
  • May 8, 2023

Thanks for that!  I’m still getting an error when trying to use it in a formula.   I am using the “customer” table, not the vendor, but should be the same essentially:

 

And my formula, I’m simply trying to leverage an IF statement, when box is checked it outputs “Required” if the box is not checked “Does Not Require”: 

But I get the following error:

 


Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • May 8, 2023

@K2a - try using this:

=iif(‘DOCAPPROVE’=1,’requires’,’does not require’)


K2a
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 92 replies
  • May 8, 2023
mikeho wrote:

@K2a - try using this:

=iif(‘DOCAPPROVE’=1,’requires’,’does not require’)

I tried that before as well, it gives me the same error. 


Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • May 8, 2023

@K2a - I suppose it also depends on your attribute type. If yours is a checkbox, try referencing the value field instead:

=iif([CSAnswers.Value]=1,’requires’,’does not require’)


K2a
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 92 replies
  • May 8, 2023
mikeho wrote:

@K2a - I suppose it also depends on your attribute type. If yours is a checkbox, try referencing the value field instead:

=iif([CSAnswers.Value]=1,’requires’,’does not require’)

It is a checkbox.   So i tried using the actual attribute from the ‘fields’ list: =iif([Customer.DOCAPPROVE_Attributes]=1,' requires ', ' does not require ')

Not sure why it appends it with the ‘_attributes’  but I tried this before and this is how I actually got to this thread because I got my original error message relating to the ‘virtual’ field: 

 


K2a
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 92 replies
  • May 8, 2023

and if I try: =iif([Csanswers.attributeid]=1,' requires ', ' does not require ')...it brings me back to the error converting to INT message...


Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • May 8, 2023

@K2a - can you try specifically using the [CSAnswers.Value] field?

=iif([CSAnswers.Value]=1,’requires’,’does not require’)


K2a
Jr Varsity III
Forum|alt.badge.img
  • Jr Varsity III
  • 92 replies
  • May 8, 2023
mikeho wrote:

@K2a - can you try specifically using the [CSAnswers.Value] field?

=iif([CSAnswers.Value]=1,’requires’,’does not require’)

OK!  That seems to have worked.  I guess the challenge is if I want to add more attributes to my GI :/

Thanks @mikeho !


Forum|alt.badge.img
  • Semi-Pro II
  • 228 replies
  • May 8, 2023

@K2a - great! Yes, if you want to add more attributes you would probably need to add the CSAnswers table to your GI again with a different Alias (e.g. “CSAnswers2”), do the same joins to the Customers table and reference the Value field from that new table in any formulas (e.g. [CSAnswers2.Value]).


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings