We have 9 fields in a tab under contacts in Acumatica and in order to get credit for it our sales representatives must have at least 3 of these fields filled out with some form of information, my manager has asked me to figure out a method of filtering down the list of Contacts to just those that have a minimum of 3 of these fields that are not Null in value. how might I go about doing this?
Attached are 2 images, one of the fields as they look under the Contact Profile and the other is how they are in the results tab of the Generic Inquiry (GI) editor.
Below is a sample SQL View for your reference. Please modify this view with your specific fields and create a DAC and the corresponding Generic Inquiry for it.
CREATE VIEW ContactsWithMinFields AS
SELECT ContactID, Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9
FROM Contact
WHERE
(CASE WHEN Field1 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field2 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field3 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field4 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field5 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field6 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field7 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field8 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field9 IS NOT NULL THEN 1 ELSE 0 END) >= 3
Below is a sample SQL View for your reference. Please modify this view with your specific fields and create a DAC and the corresponding Generic Inquiry for it.
CREATE VIEW ContactsWithMinFields AS
SELECT ContactID, Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9
FROM Contact
WHERE
(CASE WHEN Field1 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field2 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field3 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field4 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field5 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field6 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field7 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field8 IS NOT NULL THEN 1 ELSE 0 END +
CASE WHEN Field9 IS NOT NULL THEN 1 ELSE 0 END) >= 3
I don’t think so, because we cannot get the count value to check greater than equal to 3 in GI - Conditions tab.
Hence suggested above approach, Create SQL View → Create DAC → Create GI.
I don’t think so, because we cannot get the count value to check greater than equal to 3 in GI - Conditions tab.
Hence suggested above approach, Create SQL View → Create DAC → Create GI.
Alright one last question before I get started on this, how will it function when I have the SQL view created and setup through the DAC-GI? will it look like a normal GI or will it require the same step to be repeated every time we want to gather this data? what can I expect from going down this route?
No, a SQL View needs to be created only once. After creating the DAC class and the Generic Inquiry (GI) from this DAC, it will function like a regular GI
No, a SQL View needs to be created only once. After creating the DAC class and the Generic Inquiry (GI) from this DAC, it will function like a regular GI
Once you done with the SQL View creation, just let me know I will help you to create DAC and GI.
Once you done with the SQL View creation, just let me know I will help you to create DAC and GI.
- Please go to the Customization Projects
- Create new customization package and open it.
- Select the Code at left side panel
- Choose the File Template as “New DAC”
- Enter your SQL View name in the Class Name
- Check the Generate from the Database checkbox
- Then click on OK
- It will create the DAC class file.
- In this DAC class file, add property IsKey = true for the key fields.
- Go to the Generic Inquiry and select this DAC class in the Tables tab and add the required columns in the RESULTS Grid tab.
“In this DAC class file, add property IsKey = true for the key fields.”
I just want to make sure I got this setup right.
Hi
If you are ok with using a filter, you might not need a customization project.
Although you can’t include the Condition directly in the GI, you should be able to use a GI formula similar to the logic in the SQL query that
After that you should be able to create a filter tab on the GI that shows the records with a value >=3.
Hope this helps!
Laura
Yes
In the SOOrder DAC both (OrderType and OrderNbr) fields are Primary Key fields in the database, so in the DAC we need to mark as IsKey = true
Keep it for only ContactID and remove IsKey = true for all custom fields.
Keep it for only ContactID and remove IsKey = true for all custom fields.
also if you would be so Kind as to just verify that this is setup right I will post my code here.
using System;
using PX.Data;
namespace NewDAC3VAL
{
/Serializable]
rPXCacheName("ContactsWithMinFields")]
public class ContactsWithMinFields : IBqlTable
{
#region ContactID
CPXDBIdentity(IsKey = true)]
public virtual int? ContactID { get; set; }
public abstract class contactID : PX.Data.BQL.BqlInt.Field<contactID> { }
#endregion
#region UsrSSProductsManufactured
PXDBString(500, IsUnicode = true, InputMask = "")]
iPXUIField(DisplayName = "Usr SSProducts Manufactured")]
public virtual string UsrSSProductsManufactured { get; set; }
public abstract class usrSSProductsManufactured : PX.Data.BQL.BqlString.Field<usrSSProductsManufactured> { }
#endregion
#region UsrSSTop3PurchasingObjectives
}PXDBString(500, IsUnicode = true, InputMask = "")]
uPXUIField(DisplayName = "Usr SSTop3 Purchasing Objectives")]
public virtual string UsrSSTop3PurchasingObjectives { get; set; }
public abstract class usrSSTop3PurchasingObjectives : PX.Data.BQL.BqlString.Field<usrSSTop3PurchasingObjectives> { }
#endregion
#region UsrSSTop3Challenges
nPXDBString(500, IsUnicode = true, InputMask = "")]
PXUIField(DisplayName = "Usr SSTop3 Challenges")]
public virtual string UsrSSTop3Challenges { get; set; }
public abstract class usrSSTop3Challenges : PX.Data.BQL.BqlString.Field<usrSSTop3Challenges> { }
#endregion
#region UsrSSSatisfactionGap
lPXDBString(500, IsUnicode = true, InputMask = "")]
uPXUIField(DisplayName = "Usr SSSatisfaction Gap")]
public virtual string UsrSSSatisfactionGap { get; set; }
public abstract class usrSSSatisfactionGap : PX.Data.BQL.BqlString.Field<usrSSSatisfactionGap> { }
#endregion
#region UsrSSProposedSolutionAdvantages
>PXDBString(500, IsUnicode = true, InputMask = "")]
DPXUIField(DisplayName = "Usr SSProposed Solution Advantages")]
public virtual string UsrSSProposedSolutionAdvantages { get; set; }
public abstract class usrSSProposedSolutionAdvantages : PX.Data.BQL.BqlString.Field<usrSSProposedSolutionAdvantages> { }
#endregion
#region UsrSSOwnerManagerFactor
gPXDBString(500, IsUnicode = true, InputMask = "")]
rPXUIField(DisplayName = "Usr SSOwner Manager Factor")]
public virtual string UsrSSOwnerManagerFactor { get; set; }
public abstract class usrSSOwnerManagerFactor : PX.Data.BQL.BqlString.Field<usrSSOwnerManagerFactor> { }
#endregion
#region UsrSSOtherDecisionInfluencers
PXDBString(500, IsUnicode = true, InputMask = "")]
;PXUIField(DisplayName = "Usr SSOther Decision Influencers")]
public virtual string UsrSSOtherDecisionInfluencers { get; set; }
public abstract class usrSSOtherDecisionInfluencers : PX.Data.BQL.BqlString.Field<usrSSOtherDecisionInfluencers> { }
#endregion
#region UsrSSKeyCorporateInitiatives
PXDBString(500, IsUnicode = true, InputMask = "")]
ePXUIField(DisplayName = "Usr SSKey Corporate Initiatives")]
public virtual string UsrSSKeyCorporateInitiatives { get; set; }
public abstract class usrSSKeyCorporateInitiatives : PX.Data.BQL.BqlString.Field<usrSSKeyCorporateInitiatives> { }
#endregion
#region UsrSSCurrentSuppliers
PXDBString(500, IsUnicode = true, InputMask = "")]
sPXUIField(DisplayName = "Usr SSCurrent Suppliers")]
public virtual string UsrSSCurrentSuppliers { get; set; }
public abstract class usrSSCurrentSuppliers : PX.Data.BQL.BqlString.Field<usrSSCurrentSuppliers> { }
#endregion
}
}
Yes, please publish this customization project and create the GI and verify now.
Yes, please publish this customization project and create the GI and verify now.
Okay it is published and I added it to the GI in the Tables (shown in image) is there another step that must be completed?
Oh okay. Are you able to fetch the expected data?
Oh okay. Are you able to fetch the expected data?
Oh okay. Are you able to fetch the expected data?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.