Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

how validate default dimension value using x++

(0) ShareShare
ReportReport
Posted on by
supoose i have a defualt dimension=/SectionD/ and its display value is /Outdoor/ , how to validate is this value exists in system for section d or not ?
  • Martin Dráb Profile Picture
    Martin Dráb 230,433 Most Valuable Professional on at
    how validate default dimension value using x++
    All right, so you mean "yes" to the question in the very first reply where I asked whether you mean "whether it exists in the backing table, i.e. it can potentially be used as a dimension value". But... what if the department exists but the value is suspended or not valid in for the given date and company? It's not clear whether you didn't mention these things because you're aren't interested in them or because you failed to specify your actual requirements.
  • how validate default dimension value using x++
    if i pass values apart from these values for department , it should throw error , department values dont exists 
     
  • how validate default dimension value using x++
    ok i mean, suppose Department
     public boolean validateFinDim(str _String)
        {
            DimensionAttributeValue             dimensionAttributeValue;
            DimensionAttribute                  dimensionAttribute;
            boolean                             ret = true;
            container                           dimCon = str2con('102-345', "-");
    
            // Departments
            if(conPeek(dimCon, 1) != "")
            {
                dimensionAttribute      = DimensionAttribute::findByName('Department');
                dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(dimensionAttribute, conPeek(dimCon, 1), false, true);
     
                if (!dimensionAttributeValue.RecId)
                {
                   ret =  checkFailed("Financial dimension Department value is not correct.");
                }
    return ret;
            }
    }
    have these display values in system 1,2,3,4,5 , if someone use other than these system should throw error , i have created this method , is this approach fine ?
  • Martin Dráb Profile Picture
    Martin Dráb 230,433 Most Valuable Professional on at
    how validate default dimension value using x++
    You just the same thing, i.e. that the value should exist, but you didn't explain what you mean by that. Please answer the question in my previous reply.

    And how do you define "usable"?
  • how validate default dimension value using x++
    yes first i have to validate if its display values exists in the system or not , and if its value is usable or not ,
  • Martin Dráb Profile Picture
    Martin Dráb 230,433 Most Valuable Professional on at
    how validate default dimension value using x++
    What do you mean by whether the value exists?
     
    Whether it exists in the backing table, i.e. it can potentially be used as a dimension value? Or whether it exists in DimensionAttributeValue table, i.e. it is or it was used as a dimension value? Or something else?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,703 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,433 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans