Created
December 19, 2015 11:52
-
-
Save klaaz0r/f74f44bad92fa7294f6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
v_amount_of_columns_total NUMBER; | |
apex_templateid NUMBER; | |
apex_businessruleid NUMBER; | |
v_amount_of_columns_used NUMBER; | |
BEGIN | |
apex_templateid := :P70_TEMPLATEID; | |
apex_businessruleid := :P70_ID; | |
--CHECK THE AMOUNT OF VALUES A TEMPLATE IS ALLOWED TO USE | |
SELECT amount_of_values | |
INTO v_amount_of_columns_total | |
FROM template | |
WHERE id = apex_templateid; | |
--CHECK HOW MANY VALUES ARE ALREADY USED | |
SELECT Count(*) | |
INTO v_amount_of_columns_used | |
FROM rule_column | |
WHERE businessruleid = apex_businessruleid; | |
--THIS IS PURE FOR TESTING! | |
htp.P ('<script>console.log("testing function\n COLUMNS USED:' | |
||v_amount_of_columns_used | |
||' \nCOLUMNS TOTAL:' | |
|| v_amount_of_columns_total | |
||'\nRULE ID:' | |
||:P70_ID | |
||'");</script> '); | |
IF( v_amount_of_columns_total = v_amount_of_columns_used ) THEN | |
htp.P ('<script>console.log("correct amount of rows shown");</script> '); | |
ELSE | |
LOOP | |
--ADDING ROWS IF NEEDED | |
htp.P ('<script> | |
$(document).ready(function(){ | |
apex.widget.tabular.addRow(); | |
}); | |
</script> '); | |
v_amount_of_columns_used := v_amount_of_columns_used + 1; | |
EXIT WHEN v_amount_of_columns_used >= v_amount_of_columns_total; | |
END LOOP; | |
END IF; | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment