2012-06-14 11 views
6


मेरी क्रिस्टल रिपोर्ट में रोमन अक्षरों (i, ii, iii, iv आदि) के रूप में धारावाहिक संख्या प्रदर्शित करने की आवश्यकता है। मेरे पास सीरियल नंबर रिकॉर्ड नंबर (1,2,3,4 ...) के रूप में कब्जा कर लिया गया है। इसलिए मुझे क्रिस्टल रिपोर्ट में इसके लिए क्या करना है।क्रिस्टल रिपोर्ट्स में रोमन अक्षरों के रूप में सीरियल नंबर प्रदर्शित करें

उत्तर

1

मैं अधिक क्रेडिट नहीं ले सकता; मैं बस क्रिस्टल में this VB Helper article से कोड भेजा है, लेकिन यह एक मजेदार व्यायाम था:

NumberVar iCounter := 0; 
Local StringVar ch := ""; 
Local NumberVar result := 0; 
Local NumberVar new_value := 0; 
Local NumberVar old_value := 0; 
Local StringVar temp := ""; 

temp := UpperCase({[email protected]}); 

old_value = 1000; 

For iCounter := 1 To Len(temp) do 
(
    // See what the next character is worth. 
    ch := Mid(temp, iCounter, 1); 

    if ch = "I" then new_value := 1 
    else if ch = "V" then new_value := 5 
    else if ch = "X" then new_value := 10 
    else if ch = "L" then new_value := 50 
    else if ch = "C" then new_value := 100 
    else if ch = "D" then new_value := 500 
    else if ch = "M" then new_value := 1000; 

    // See if this character is bigger 
    // than the previous one. 
    If new_value > old_value Then 
     // The new value > the previous one. 
     // Add this value to the result 
     // and subtract the previous one twice. 
     result := result + new_value - 2 * old_value 
    Else 
     // The new value <= the previous one. 
     // Add it to the result. 
     result := result + new_value; 

    old_value := new_value; 
); 

// Format the number without commas or decimals 
ToText(result, 0, ""); 

बस अपने चर के साथ मेरी {[email protected]} पैरामीटर प्लेसहोल्डर की जगह है, और आप पूरी तरह तैयार हैं।

1

क्रिस्टल रिपोर्ट

द्वारा प्रदान किए गए रोमन() फ़ंक्शन का उपयोग करें
संबंधित मुद्दे