Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

how to show all data with conpeek

Posted on by 85

hello everyone

can anyone help me.

i learn about marking in ax 2012 to get sales id dan custaccount and i get example like this : 

private void countFromFN2(ProdId _prodIdFN2)
{
prodTable = ProdTable::find(_prodIdFN2);
getProdMarking = new AGSGetProdMarking(prodTable, InventDim::find(prodTable.InventDimId));

markedProdConFN2 = getProdMarking.getMarkedProd();
markedQtyConFN2 = getProdMarking.getMarkedQty();

containerPROLength = conLen(markedProdConFN2);

for(counterPRO = 1; counterPRO <= containerPROLength; counterPRO++)
{
prodIdPRO = conPeek(markedProdConFN2,counterPRO);

prodTable = ProdTable::find(prodIdPRO);
getProdMarking = new AGSGetProdMarking(prodTable, InventDim::find(prodTable.InventDimId));

markedProdConPRO = getProdMarking.getMarkedProd();

containerPSTSLength = conLen(markedProdConPRO);

for(counterPSTS = 1; counterPSTS <= containerPSTSLength; counterPSTS++)
{
prodIdPSTS = conPeek(markedProdConPRO,counterPSTS);

prodTable = ProdTable::find(prodIdPSTS);
getProdMarking = new AGSGetProdMarking(prodTable, InventDim::find(prodTable.InventDimId));

markedProdConPSTS = getProdMarking.getMarkedProd();

containerSOLength = conLen(markedProdConPSTS);

for(counterSO = 1; counterSO <= containerSOLength; counterSO++)
{
salesId = conPeek(markedProdConPSTS,counterSO);

_salesTable = SalesTable::find(salesId);

if(_salesTable)
{
_soTemp += salesId;
_prodTemp += prodIdPSTS;

_custTemp += _salesTable.CustAccount;
_simbulTemp += InventDim::find(prodTable.InventDimId).InventColorId;

select firstFast firstOnly _salesLine
where _salesLine.SalesId == salesId
&& _salesLine.ItemId == prodTable.ItemId;

_noExtTemp += _salesLine.ExternalItemId;
}
}
}
}

how to show all the data that i get in salesid variable. when i show the data all the data i get are show together in one line

exmple like : D00032D00042D00056 

but i want to show the data like : D00032

D00042

D00056

because from that sales id i should search a custaccount from salestable

thanks,

*This post is locked for comments

  • Rvp_ Profile Picture
    Rvp_ 85 on at
    RE: how to show all data with conpeek

    yess, thank you so much hossein, this really help me

  • Hossein.K Profile Picture
    Hossein.K 6,642 on at
    RE: how to show all data with conpeek

    Rahmat,your problem is solved?right?

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: how to show all data with conpeek

    Like previous people suggested, put spaces in your string if you need them. Assuming you want to store the values in a string.

    About the error message, I can just say that it would help a lot if you shared the code that causes it.

  • Verified answer
    Hossein.K Profile Picture
    Hossein.K 6,642 on at
    RE: how to show all data with conpeek

    Hi Rahmat VP,

    Change this line:

    _custTemp += _salesTable.CustAccount;


    To:

    _custTemp += " ";
    _custTemp += _salesTable.CustAccount;


  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: how to show all data with conpeek

    If all you want is to add a space, then add a space - what's the problem? You get a string without spaces because your told your code to do that (_custTemp += _salesTable.CustAccount); you could change it to something like _custTemp += " " + _salesTable.CustAccount. Or you can put individual values to a container and then convert it to string with con2str().

    Note that you still didn't tell us what you mean by "show the data". We can't find the bug if you don't tell us what you're doing.

  • Rvp_ Profile Picture
    Rvp_ 85 on at
    RE: how to show all data with conpeek

    but how to break the data like : D00032D00042D00056  to D00032  D00042  D00056 from salesid

    and when i show the data from _custTemp. there is an error and it become and integer data

    i got this error 

    4353.123.png

    i wanna show the data in SSRS Report.

    btw, thank you and im sorry because im new in ax 2012 and also new in this forum

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: how to show all data with conpeek

    First of all, please format your code using the "Use rich text formatting" -> "</>". Otherwise it's really difficult to read.

    This time I made it for you.

    private void countFromFN2(ProdId _prodIdFN2)
    {
    	prodTable = ProdTable::find(_prodIdFN2);
    	getProdMarking = new AGSGetProdMarking(prodTable, InventDim::find(prodTable.InventDimId));
    
    	markedProdConFN2 = getProdMarking.getMarkedProd();
    	markedQtyConFN2 = getProdMarking.getMarkedQty();
    
    	containerPROLength = conLen(markedProdConFN2);
    
    	for(counterPRO = 1; counterPRO <= containerPROLength; counterPRO++)
    	{
    		prodIdPRO = conPeek(markedProdConFN2,counterPRO);
    
    		prodTable = ProdTable::find(prodIdPRO);
    		getProdMarking = new AGSGetProdMarking(prodTable, InventDim::find(prodTable.InventDimId));
    
    		markedProdConPRO = getProdMarking.getMarkedProd();
    
    		containerPSTSLength = conLen(markedProdConPRO);
    
    		for(counterPSTS = 1; counterPSTS <= containerPSTSLength; counterPSTS++)
    		{
    			prodIdPSTS = conPeek(markedProdConPRO,counterPSTS);
    
    			prodTable = ProdTable::find(prodIdPSTS);
    			getProdMarking = new AGSGetProdMarking(prodTable, InventDim::find(prodTable.InventDimId));
    
    			markedProdConPSTS = getProdMarking.getMarkedProd();
    
    			containerSOLength = conLen(markedProdConPSTS);
    
    			for(counterSO = 1; counterSO <= containerSOLength; counterSO++)
    			{
    				salesId = conPeek(markedProdConPSTS,counterSO);
    
    				_salesTable = SalesTable::find(salesId);
    
    				if(_salesTable)
    				{
    					_soTemp += salesId;
    					_prodTemp += prodIdPSTS;
    
    					_custTemp += _salesTable.CustAccount;
    					_simbulTemp += InventDim::find(prodTable.InventDimId).InventColorId;
    
    					select firstFast firstOnly _salesLine
    						where _salesLine.SalesId == salesId
    						&& _salesLine.ItemId == prodTable.ItemId;
    						_noExtTemp += _salesLine.ExternalItemId;
    				}
    			}
    		}
    	}
    } 


    I don't fully understand your question. You can get one value from container using the conPeek function. You can get all container values using con2str function.

    You seem to be adding all the strings in "_custTemp" variable. So eventually that variable will contain all customer accounts, without any whitespaces.

    What do you mean by "showing" the data? Do you want to print it to infolog? Or save in a table? 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans