Nested IF in DFD

What is wrong with this and why am I getting an error? (The formula is invalid: Unknown token found during parsing)

I want to calculate the Vendor ID based on Vendor Name. In fact even just a simple IF isn’t working for me.

IF (FT_VENDOR_NAME=‘VENDOR ONE’,‘VEND1’,
IF (FT_VENDOR_NAME=‘VENDOR TWO’,‘VEND2’,
IF (FT_VENDOR_NAME=‘VENDOR THREE’,‘VEND3’,
IF (FT_VENDOR_NAME=‘VENDOR FOUR’,‘VEND4’,‘’)
)
)
)

Well who knew! Changing to double quotes fixed my issue.

2 Likes

Glad that you go it solved. You can also do this for all vendors like this.

SQLEXEC(STRJOIN("SELECT [VendorID] FROM [docstarIdcServerDb].[dbo].[VendorName_ID] where name like '",FT_VENDOR_NAME,"%'"))
1 Like

Thanks. We don’t have the Vendors in the IDC db. The user has to select it from a hard-coded dropdown.

Maybe someday we will set that up.

but… it doesn’t seem to work.

I have VendorID as Assignable, Selectable, Required and a list of options to select from.

Then I have VendorName as AutoCalculate and dependent on VendorID.

But nothing happens in the VendorName field. it is blank and stays blank.

Error says:
Error: Assigning to non-scope variable. Scope variables start with @. in formula.

You original post and formula looks to be setup to populate the VendorID from the VendorName field and I imagine you have this in the Formula field for the VendorName. I think you just need to rearrange which field will generate the output in the other.

Essentially you want IF(FT_VENDOR_ID=“VEND1”,“VENDOR ONE”) in the VendorName field. You would then make the Flags for VendorName be Assignable, Required, Calculate and Auto-Calculate. You could also have the Selectable Flag and options, if you wanted to provide choices for the user.

If you’re looking to do the opposite and have the VendorID populate from the VendorName, you would switch things around.

I did switch it around, sorry. But it is still not working.

This is the Formula for FT_Vendor_Name:

IF (FT_VendorID=“VEND1”,“VENDOR ONE”,
IF (FT_VendorID=“VEND2”,“VENDOR TWO”,
IF (FT_VendorID=“VEND3”,“VENDOR THREE”,
IF (FT_VendorID=“VEND4”,“VENDOR FOUR”,“”))))

I am using the “Preview” and selecting VEND1.
FT_VENDOR_NAME stays blank. I click the calculator and nothing happens. I hover and I see the same scope variable error.

The Dependent Items switches automatically as shown in the screenshot.

image

No need to apologize, we’re all here to help!

I think I see what the problem is and it’s literally not a you thing but an IDC thing lol It’s one I get stuck on often, too.

Try this as your formula:
IF (EQ(FT_VendorID,“VEND1”),“VENDOR ONE”,
IF (EQ(FT_VendorID,“VEND2”),“VENDOR TWO”,
IF (EQ(FT_VendorID,“VEND3”),“VENDOR THREE”,
IF (EQ(FT_VendorID,“VEND4”),“VENDOR FOUR”,“”))))

NOTE: You may need to reinput the " marks as it may not interpret them accurately when copying and pasting.

2 Likes

YES! Thank you so much, that worked!

No problem! Not sure if you have signed up for the Ancora website, but this may prove useful in the future: Login – ancora Software Product Documentation

I use it all of the time, but this forum has also been incredibly helpful.

If you are linking to Epicor it is just a view from a linked server that IDC uses. I would help you set it up.

We use Dynamics GP.

I tried to request a pw reset for the ancora site, but the link they send doesn’t work. I’ll contact them.
Trying to make IDC smarter!