Tuesday, July 5, 2022

Crystal Reports Concatenate Data

 Sometimes in crystal we might be required to concatenate the values of fields that belong to a particular group as a single line.


For example the below data in the table needs to be displayed as below. I used global variables and formula

LEVEL1  : T01,T02

LEVEL2  : T04

LEVEL3  : T10,T11




Level ID
LEVEL1T01
LEVEL1
T02
LEVEL2
T04
LEVEL3T10
LEVEL3T11

Wednesday, June 1, 2022

Calculate Percentage correctly across columns

 When we need to show the percentage on a report/excel  and we have to divide by an odd number , we should divide by an even number and then computed values should be used for the last group.

Example: Col1 = 30/105    

                Col2=50/105

                Col3=25/105


So percentage for col1 and col2 is calculated then the difference is used for col3

Thursday, December 23, 2021

Update an id column to be sequential

 Sometimes we come across a table in which a column that is supposed to store values in sequence , but over time they get values in the column are in random order to resolve this so that the id column has a sequence.

update parameter_table set parameter_id=rownum;

Monday, July 5, 2021

radio button default value blank

there will be an error when submitting to database, if a radio button can have a default value of blank.

having a blank value will not allow the radio button to be transferred to the database.

Wednesday, August 12, 2020

Javascript Alert Message Truncated

Sometimes when the javascript alert message is truncated in the webmessage window in internet explorer, you can embedd \r\n in the message or it the user might be using a extra monitor. By asking the user to use view the website on their laptop, the issue got resolved.

Thursday, August 6, 2020

Pass String to JavaScript

In order to pass a string value as parameter to a javascript function using htp.p. I used the below mechanism by enclosing it in 2 single quotes.

         htp.p('<td colspan="1" style="text-align:left"> <input type="text" id="processing_spatial_number_of_changes'||i||'" name="process_sp_number_of_changes" size="5" ' ||
     lv_sp_classname ||' value="" onblur="checkisnumtext(this,''# of Changes in Processing Section'');"  ></td>');

function checkisnumtext(field,text1)
{
  var s_token_num=field.value;
  var isnum = /^\d+$/.test(s_token_num);
     if (! isnum) {
        alert(text1 + " should contain only numeric digits");
        return false;
     }
     else{
      //alert(text1 + " contains only numeric digits");
      return true;
    }  
}
//end function checkisnumtext

Thursday, May 28, 2020

OWA_UTIL textarea

Had an issue with passing data from a textarea in html to the backend. Kept getting buffer is small so had to use

owa_util.vc_arr.

while inserting text from a form we have the following options based on the number of characters.

1) VARCHAR2

2) declare a type in package and use it

TYPE Notes_Array_Type  IS TABLE OF VARCHAR2(2500) INDEX BY BINARY_INTEGER; 

posted_comments   Notes_Array_Type ;


3)owa_util.ident_arr  is table of varchar2(30) index by binary_integer;

4) owa_util.vc_arr is table of varchar2(32000) index by binary_integer;