Help with Script Logic
Hi All
I am trying to write the following script
*INCLUDE ..\finance\system_constants.lgl
*XDIM_MEMBERSET RATE=AVG,END
*SELECT(%IP_Currencies%, "[ID]", "INPUTCURRENCYDIM", "[MD] = 'D' OR [MD]= 'M'") )
*XDIM_MEMBERSET INPUTCURRENCY= %IP_Currencies%
*XDIM_MEMBER RATESRC=RATEINPUT
*WHEN INPUTCURRENCY.MD
*IS "D"
*REC(EXPRESSION=ROUND(1/%VALUE%,6),RATESRC="RATECALC")
*ELSE
*REC(RATESRC="RATECALC")
*ENDWHEN
*CLEAR_DESTINATION
*DESTINATION RATESRC=RATECALC
My LGX file looks like this.
*XDIM_MEMBERSET RATE=AVG,END
*XDIM_MEMBERSET INPUTCURRENCY= DZD,USD,ARS,AUD,ATS,BSD,BBD,BEF,BMD,BRL,GBP,BGN,CAD,CLP,CNY,CYP,CZK,DKK,XCD,EGP,EUR,FJD,FIM,FRF,DEM,XAU,GRD,HKD,HUF,ISK,INR,IDR,IEP,ILS,ITL,JMD,JPY,JOD,LBP,LUF,MYR,MXN,NZD,NOK,NLG,PKR,PHP,XPT,PLN,PTE,ROL,RUR,SAR,XAG,SGD,SKK,ZAR,KRW,ESP,XDR,SDD,SEK,CHF,TWD,THB,TTD,TRL,VEB,ZMK
*XDIM_MEMBER RATESRC=RATEINPUT
*WHEN INPUTCURRENCY.MD
*IS "D"
*REC(EXPRESSION=ROUND(1/%VALUE%,6),RATESRC="RATECALC")
*ELSE
*REC(RATESRC="RATECALC")
*ENDWHEN
*CLEAR_DESTINATION
*DESTINATION RATESRC=RATECALC
It gets validated fine and it also runs successfully through DPM. But the problem i am facing is that the above script is only running and posting data for USD in RATECALC where as I have lot many currencies listed in "INPUTCURRENCYDIM". It does not execute for any other currency except for USD. I want to run it for all the currencies.
Please suggest.
Diksha.
Edited by: Diksha Chopra on Jun 3, 2010 9:23 PM
Hi Diksha,
Please check in your inputcurrency dimension, how many members are there with the property MD as D?
I would suggest you to change your scritp to
*INCLUDE ..\finance\system_constants.lgl
*XDIM_MEMBERSET RATE=AVG,END
*XDIM_MEMBER RATESRC=RATEINPUT
*WHEN INPUTCURRENCY.MD
*IS "D"
*REC(EXPRESSION=ROUND(1/%VALUE%,6),RATESRC="RATECALC")
*IS "M"
*REC(RATESRC="RATECALC")
*ENDWHEN
*COMMIT
*CLEAR_DESTINATION
*DESTINATION RATESRC=RATECALC
Hope this helps.
Similar Messages
-
Hi Experts,
We are using SAP BPC 7.5 NW Version SP08. We are using a script logic that calculates the opening value of inventory(ASSTCAINVAMO) for each month except the 1st month of financial year for which the value is entered from an input schedule. The opening value of inventory of each subsequent months are calculated when the parameters for production(e.g. OSDA) are entered from a separate input schedule. The following script logic is written for the calculation:
*FOR %TIM_MEM%=%TIME_SET%
*XDIM_MEMBERSET TIME =%TIM_MEM%
*WHEN P_ACCT2
*IS "OSDA",
REC(EXPRESSION=[P_ACCT2].[ASSTCAINVAMO]+[P_ACCT2].[RDPA][P_ACCT2].[EFFA][P_ACCT2].[OSDA]-[P_ACCT2].[CONVAMUR][P_ACCT2].[RDPU][P_ACCT2].[EFFU][P_ACCT2].[OSDU]-([P_ACCT2].[SALQAMBC]+[P_ACCT2].[SALQAMM]),P_ACCT2="ASSTCAINVAMO",TIME=TIME.NEXT)
*ENDWHEN
*COMMIT
*NEXT
The loop works fine, but it seems the list of time values are not coming in proper sequence. For example, the loop is running for 2011.NOV before it iterates for 2011.OCT. So when it iterates for 2011.NOV, it is not getting the opening value for the month and consequently 2011.DEC's opening value is calculated assuming 2011.NOV's opening value to be 0. In the input schedule the months are in proper sequence.
Is there any way out so that the months come in proper sequence in the logic as well?
Thanks in advance for any help.We had similar issue . we changed TIME members from Monthnames to numbers . i.e changed 2011.JAN to 2011.01 . Then you get correct result as you are expecting . Issue when using month names in combination of TMVL is that , instead of getting 2011. MAY for TMVL(1,2011.APR) , it gets 2011.FEB . TMVL function some how takes alphabetical order instead of taking month order . Not sure if this behavior is with service pack . But never saw any thread reporting this issue .
Anyways ,you can wait for other responses as i am too curious to know if any one faced this issue and how did they resolve. -
Hi all,
I am facing error with the script logic
Script Logic
*XDIM_MEMBERSET P_ACCT=EXTSALES,ICSALES
*WHEN P_ACCT
*IS ICSALES,EXTSALES
*REC(P_ACCT="TOTVAL")
*REC(FACTOR=.08,P_ACCT="SALAFTERTAX")
*ENDWHEN
*COMMIT
Error Message
LOG BEGIN TIME:2010-04-16 15:59:39
FILE:\ROOT\WEBFOLDERS\Student_DD \ADMINAPP\Sales\TEST.LGF
USER:MICAIT\DEVANG
APPSET:Student_DD
APPLICATION:Sales
*REC(P_ACCT="TOTVAL")
ERROR LOG:
CLASS: CL_UJK_WHEN_ENDWHEN
METHOD: ADD_LINE
TCODE: SE38
MULTI MEMBERS HAVE BEEN SPECIFIED ON DIMENSION:"P_ACCT" IN *IS SO DUPLICATE MEMBERS MAY BE GENERATED.
LOG END TIME:2010-04-16 15:59:39
UJK_VALIDATION_EXCEPTION:LINE:4 multi-member specified for dimension "4" in *IS
Thanks,
DikshaHi,
If you are in SP02, Go through this SAP Note [Note 1312132 - BPC7NW SCRIPT LOGIC: REC Behavior Fix|https://service.sap.com/sap/support/notes/1312132] that helps you in fixing this issue.
Reply me for further clarifications.
Regards,
RajK -
Package with script logic CANCELLED
Hi everybody,
I am trying to implement a very simple script logic that removes negative values from the Units account.
*XDIM_MEMBERSET C_CATEGORY=%C_CATEGORY_SET%
*XDIM_MEMBERSET TIEMPO=%TIEMPO_SET%
*XDIM_MEMBERSET MERCADO=%MERCADO_SET%
*XDIM_MEMBERSET ORG_VENTAS=%ORG_VENTAS_SET%
*XDIM_MEMBERSET CUSTOMER=BAS(TOTALCUSTOMERS)
*XDIM_MEMBERSET PRODUCT=BAS(00001)
*XDIM_MEMBERSET P_DATASRC=DRIVER
*XDIM_MEMBERSET ACCOUNT_SIM=Unit
*XDIM_MEMBERSET TIPO_CLIENTE=BAS(TOTAL_TOP)
[ACCOUNT_SIM].[#Unit]=IIF(([ACCOUNT_SIM].[Unit])*(-1)<0, 0, [ACCOUNT_SIM].[Unit])
*COMMIT
When I execute it with the Data Manager the result of the package is "Cancelled". I have one large dimension ("Customer" with more than 2000 elements) but there are not too many records in the database now. However, when I restrict the number of elements, the package works fine. It seems like a memory issue, I don't know... We are using SAP BPC NW 7.0 SP5
Any idea out there? Is our logic not 'optimized' for BPC?
Thanks a lot,
Mr. Albert MasHi Albert,
I think you're running into a dimensionality limit. I believe this was fixed in SP06.
In any case, it's easy to fix. Just add
*XDIM_MAXMEMBERS CUSTOMER = 1
after your other *XDIM statements.
You should be able to up this number a fair amount, depending on the number of members in other dimensions. In the script logic evaluation, there is code that multiplies the number of members in your memberset in each dimension and then attempts to assign the result to an INT datatype. I don't remember the size of the INT, but if you look at the short dump in ST22 of the SAP GUI, you'll see the code.
Hopefully that helps.
Ethan -
Hello friends,
I am getting an error with running currency conversion in an app, the error says Invalid dimension "C_Category". Here is the script logic, I dont see C_Category anywhere. For the record, the name of dimension is category.
*RUN_PROGRAM CURR_CONVERSION
CATEGORY = %C_CATEGORY_SET%
GROUP = %GROUPS_SET%
TID_RA = %TIME_SET%
RATEENTITY = GLOBAL
OTHER = [ENTITY=%ENTITY_SET%]//For More than one other scope parameters: OTHER = [ENTITY=%ENTITY_SET%;INTCO=%INTCO_SET%...]
*ENDRUN_PROGRAMHello,
Variable %C_CATEGORY_SET% means set of members selected for Dimension C_CATEGORY. So, if you want to use CATEGORY instead replace it with %CATEGORY_SET%, but if are running Consolidations I think you need C_CATEGORY Dimension.
Regards,
Gersh -
Help with Scripting forms when additional characters added
Hi,
I am new to scripting in adobe professional, I thank anyone in advance for any advice or help they can give me.
I am trying to use the calcuations within the forms that I am putting fields onto. In the process I discovered that the program the forms are within are attaching a pipe and additional characters after the actual name that I have named them. So, I am not able to use even the simple calculations within adobe to "sum" fields. For example: I named the field "1_1Text" and this is what displays when you go into the calculations and pick the fields you want. But the actual name is "1_1Text|1234567" so the calculations will not work.
I take it then I need to use the advanced scripting but I am unsure of the format for a routine such as this. I have a little knowledge of javascript but it has been awhile. There must be a scan to find the pipe and then you should be able to chop off the extra characters since I will never know the characters the program adds on so then I can do calculations on these fields. Then you would have to put them into an array or something to save them? Any help with a script or hints would surely be appreciated.
Thanks!Could explain more fully how you are creating your forms and what programs you are using from the creation of the base document to which program and how you are adding fields.
I think you are misunderstanding me. I use Adobe Acrobat Professional 6.0. I can get the calculations to work correctly if I use the form as it is after creating it.
But these forms are put into an SQL database and they get selected within a VB.net program or ASP.net program (both are used). So these programs (VB.net or ASP.net) are adding the extra characters at the end, hence I do not know the names of the fields when the forms are being filled in. So the calculations do not work with the "original names" that I created for the fields.
I just figured if I created a routine that looped through and chopped off the extra characters these programs put on the end I would be able to do the calcuations and they would work. I believe there is a substring operation within javascript. -
Problem with Script logic logs
Hi Experts,
I am using BPC 7.5M with SQL Server 2008, I am looking into script logic log but found one very strange statement "(More than 300,000 records. Details are not being logged)", Earlier it was not showing this statement and was showing all the entries to be posted, Is there any setting we need to do for having all the entries in the log file.
Status log file showing as of now:
App: HEADCOUNT - Records to be posted are 310875 (calc diff = 0)
(More than 300,000 records. Details are not being logged)
Time to validate records: 100.3 sec.
Post Record Status
Submit count : 100001
Accept count : 100001
Reject count : 0
Post Record Status
Submit count : 200002
Accept count : 200002
Reject count : 0
Post Record Status
Submit count : 300003
Accept count : 300003
Reject count : 0
Post Record Status
Submit count : 310875
Accept count : 310875
Reject count : 0
Posting ok
Time to post records:325.4 sec.
Please Advice
Thanks & Regards,
RohitHi Rohit,
This is not a problem.
If the resultant number of records is more than 300,000, then the records are not logged.
This can be controlled by the UNLIMIT_PRINT_LOG appset parameter. By default, this is set as NO. This will allow only 300k records to be logged.
You can set the above parameter as YES to log all the records for the execution of all logics across the appset in all applications.
Warning:
Of course, it will add slow down the logic execution. Logging the records will always slow down the execution. The system has to open the file and keep writing all the records in the flatfile, which is a slow process. You can increase the speed of your logics by disabling this logging completely by using the CALCULATE_DIFFERENCE statement in your script logic for each commit section. You can reduce the logic execution time by disabling this logging.
Karthik AJ -
Incorrect value with Script Logic
Hello,
From initial value called 2008.ORC we want to calculate for each month the percentage , from child DIASMES.
Now, with the script logic ( I´ll put down later) we have an incorrect value in the column 2008.TOTAL.
In other words, I´m sure I´m wrong with "WHAT" or "WHERE sentence or maybe the operation "FACTOR=USING/TOTAL" fails because the crossing between dimensions it´s incorrect.
*RUNALLOCATION
*FACTOR = USING/TOTAL
*DIM FABRICA_MAQ WHAT=BAS(FABRICAFF); WHERE=BAS(FABRICAFF); USING=BAS(FABRICAFF);
*DIM PRODUTOS WHAT=BAS(TOTALPROD); WHERE=BAS(TOTALPROD); USING=SP;
*DIM TIME WHAT=2008.ORC;WHERE=BAS(2008.TOTAL); USING=BAS(2008.TOTAL);
*DIM TIPO WHAT=BAS(TOT); WHERE=BAS(TOT); USING=ST;
*DIM VARIAVEIS WHAT=MIXACABADA; WHERE=MIXACABADA; USING=DIASMES;
*DIM DATASRC WHAT=INPUT; WHERE=INPUT; USING=INPUT;
*DIM VERSAO WHAT=BUDGET; WHERE=BUDGET; USING=BUDGET;
*ENDALLOCATION
*COMMIT
The Key is to see in the column 2008.TOTAL ( when we selected "BAS") the value of parent divided into "DIASMES" !
Thanks !!Your factor statment references a TOTAL, but you don't reference the total in your DIM statements. If you look at the debug log carefully, you should notice that there's no calculation of a TOTAL value.
Try something like this. The only reason I move some dimensions from the *RUNALLOCATION up to the *XDIM's is for legibility, since the allocation makes no shifts to these dimensions. The logic should produce the same results, either way.
// These dimensions have no shift of data.
*XDIM_MEMBER VERSAO=BUDGET
*XDIM_MEMBER DATASRC=INPUT
// I'm assuming here that FACRICAFF is the top member of this dimension.
*XDIM_MEMBERSET FABRICA_MAQ = <ALL>
*RUNALLOCATION
*FACTOR = USING/TOTAL
*DIM PRODUTOS WHAT=BAS(TOTALPROD); WHERE=BAS(TOTALPROD); USING=SP; TOTAL=<<<
*DIM TIME WHAT=2008.ORC;WHERE=BAS(2008.TOTAL); USING=BAS(2008.TOTAL); TOTAL=<<<
*DIM TIPO WHAT=BAS(TOT); WHERE=BAS(TOT); USING=ST; TOTAL=<<<
*DIM VARIAVEIS WHAT=MIXACABADA; WHERE=MIXACABADA; USING=DIASMES; TOTAL=<<<
*ENDALLOCATION
*COMMIT -
CSA: Use with Script Logic
Has anybody used CSA to protect a Script logic server. With so many remote applications attempting access to the script logic server and files, what method do you find is best to keep this server protected without opening up too many holes?
Thanks!
-WyleyI would make a group of servers that are allowed to talk to the Script login server and either turn off alerts for them or just make them informational.
Also create another protection policy if you want even more protection on that server. -
Need a little help with RAF logic
So Im making a program to give different users, different rights. This is the method that appends them to file and Map
* Writes the players rights to the appendages
* @param playerName Player to update
* @param playerRights Rights to give the player
* @param pointer The lines index in the files
* @throws IOException If a read/write error occours
public void writeRights(String playerName, Rights playerRights, long pointer) throws IOException {
rightsRAF.seek(pointer);
rightsRAF.write(("\n" + playerName + "::" + playerRights).getBytes());
if(rightsRAF.read() != '\n') {
rightsRAF.seek(rightsRAF.getFilePointer()-1);
rightsRAF.write("\n".getBytes());
rightsMap.put(playerName, playerRights);
}1. The RAF goes to the predetermined index in the file, pointer, which is the line the users name starts on. Entries are stored in the file as "name::RIGHTS"
2.It writes out the players name, and rights
3. It checks to see if it accidentally wrote over the \n
My problem now, is that some rights are longer than others. For example, if there was already an entry, "name::MODERATOR" and you overwrite it, with "name::OWNER" then it would turn into "name::OWNERATOR" because the rest of the line wasn't overwritten.
I need some help with logic to determine how to overwrote the entire line, because sometimes you could go from a short one, to a long one, and need to append a new \n character, and sometimes you could go the other way around from long to short and end up with two words fused, I cant figure out how to determine whats a word that got partially overwritten and whats a new line totally.
ThanksAs pointed out you need to have fixed size records, or at least a maximum size.
You also have another problem nobody commented on yet (I don't think) with the getBytes() calls. At that point in your code you will mangle most unicode Strings.
All things being equal here I think your best solution is to use an embedded database like JavaDB with JDBC. I think you will find an XML solution to slow for your purposes.
If you decide to continue the RAF route though here is an example. I know this is not exactly what you are doing but you can extrapolate from this...
public void updatePlayerName(String playerName, int playerIndex){
int recordlength = 200;
byte[] buff = playerName.getBytes("UTF-8");
if(buff.length>recordlength){
//truncate bytes. this is also not great because a character at the end could be mangled
byte[] temp = new byte[recordlength];
System.arraycopy(buff,0,temp,0,temp.length);
buff = temp;
long pointer = playerIndex * (recordlength+4);// plus 4 bytes per record for actual length
raf.seek(pointer);
raf.writeInt(buff.length);
raf.write(buff);
public String getPlayerName(int playerindex){
int recordlength = 200;
long pointer = playerIndex * (recordlength+4);
raf.seek(pointer);
int lengthToRead = raf.readInt();
//length to read should be checked for sanity or bad things will happen next
byte[] buff = new byte[lengthToRead];
raf. readFully(buff);
return new String(buff,"UTF-8");
}And then of course you'd have to add storing the "rights". It gets complicated in a hurry. I do really recommend the JDBC route. -
Help in script logic - problem in FOR loop
Hi Experts,
We are using BPC 7.5 SP08. I have written a FOR loop in script logic default.lgf which is as follows:
*FOR %TIM_MEM%=%TIME_SET%
*XDIM_MEMBERSET TIME =%TIM_MEM%
*WHEN P_ACCT2
*IS "OSDU"
REC(EXPRESSION=[P_ACCT2].[ASSTCAINVURO][P_ACCT2].[COGSUPRVIPSA]/[P_ACCT2].[ASSTUPRVTAQTY],P_ACCT2="COGSUIPSAO")
*ENDWHEN
*COMMIT
*NEXT
As per my requirement, all this members: [ASSTCAINVURO], [COGSUPRVIPSA], [ASSTUPRVTAQTY] exists for months September to next year's August. But in my input schedule, the months are from August to next year's July(which is the company's fiscal year). Consequently the loop runs for month August to next year's July while I need to run the loop 1 month late(i.e. September to next year's August). This was achieved earlier by hard-coding the time members which we cannot afford as this requires to update these hard-coded member IDs every year.
We have also tried using the "NEXT" property of TIME dimension as follows:
*XDIM_MEMBERSET TIME =%TIM_MEM%.NEXT
but %TIM_MEM%.NEXT doesn't get the month in 'NEXT'.
Please suggest if there is any way out to solve this problem.
Thanks in advance.Hi Appu,
Even if you restrict the scope using the XDIM statement, your script will just run the number of times as per the for loop. Actually, in reality, the same calculation is happening again and again, in your code; since your calculation is not based on the time member.
To use the for loop effectively, you need to incorporate the time member in your calculation.
Please look at the below sample code:
*XDIM_MEMBERSET TIME = %TIME_SET%
*FOR %TIM_MEM%=%TIME_SET%
*WHEN P_ACCT2
*IS "OSDU"
*REC(EXPRESSION=<CALCULATION>,P_ACCT2="COGSUIPSAO")
*ENDWHEN
*NEXT
And in your calculation, you can use statements like
([P_ACCT2].[ASSTCAINVURO],TMVL(1, [TIME].[%TIM_MEM%]))
This will ensure that everytime (as per the for loop), the calculation works on separate set of data.
Hope you got the idea. -
Hi Experts,
We're trying to run script logic for allocations, but aren't able to sum to values to one Costelement.
In the Account dimension we have:
- Costelements (CE)
- Keyfigures (KF)
- Prices (PR)
What we want to do is:
write (KF_A * PR_A) + (KF_B * PR_B) to CE_A
Any suggestions on the right syntax would be very welcome.
Regards,
VincentHi,
Can you explain me clearly so that i can give you solution.
Regards,
Naresh.K -
There is request to dump every days data from one table into text file. I need to write shell script and sql script for that
There are two tables (INSPECTION_RESULTS and NJAS) under NJSHDOWN schema. The table NJAS is child table of INSPECTION_RESULTS. The key is RES_SYS_NO. The script should get the MIN and MAX RES_SYS_NO from INSPECTION_RESULTS table for yesterdays date. Then use these RES_SYS_NOs to fetch data from NJAS table. I then need to create comma delimited file for following columns. Also, to add the logic in shell script to check for oracle error (ORA-). If there is error, it should send email to DBAs group(first test it with your email address).
Following columns are needed from NJAS table.
NJA_RES_SYS_NO
NJA_TEST_REC_NO
NJA_LIC_ST_ID
NJA_ETS_ID
NJA_SW_VER
NJA_TECH_ID
NJA_VIN
NJA_LIC_NO
NJA_LIC_JUR
NJA_LIC_SRC
NJA_MODEL_YR
NJA_MAKE
NJA_MODEL
NJA_VHCL_TYPE
NJA_BODY_STYLE
NJA_CERT_CLASS
NJA_GVWR
Okay- here is the script that I have so far but now, I am stuck. I cannot figure out how to get my script to finish output to comma delimited file and to check for oracle errors. Can anyone help me out here? Thanks!
Initial script:
SELECT NJA_RES_SYS_NO, NJA_RES_SYS_NO, NJA_TEST_REC_NO,
NJA_LIC_ST_ID,
NJA_ETS_ID,
NJA_SW_VER,
NJA_TECH_ID,
NJA_VIN,
NJA_LIC_NO,
NJA_LIC_JUR,
NJA_LIC_SRC,
NJA_MODEL_YR,
NJA_MAKE,
NJA_MODEL,
NJA_VHCL_TYPE,
NJA_BODY_STYLE,
NJA_CERT_CLASS,
NJA_GVWR,
NJA_ASM_ETW,
NJA_ETW_SRC,
NJA_NO_OF_CYL,
NJA_ENG_SIZE,
NJA_TRANS_TYPE,
NJA_DUAL_EXH,
NJA_FUEL_CD,
NJA_VID_SYS_NO,
NJA_VRT_REC_NO,
NJA_ARMSTDS_REC_NO,
NJA_RSN_F_N_TESTABLE,
NJA_DYNO_TESTABLE,
NJA_CURR_ODO_RDNG,
NJA_PREV_ODO_RDNG,
NJA_PREV_TEST_DT,
NJA_TEST_TYPE,
NJA_TEST_START_DT,
NJA_TEST_END_TIME,
NJA_EMISS_TEST_TYPE,
NJA_TEST_SEQ_NO,
NJA_LOW_MILE_EXEMP,
NJA_TIRE_DRY,
NJA_REL_HUMID,
NJA_AMB_TEMP,
NJA_BAR_PRESS,
NJA_HCF,
NJA_GAS_CAP_ADAP_AVL,
NJA_GAS_CAP_REPL,
NJA_OVERALL_GAS_CAP_RES
FROM NJAS
WHERE NJA_RES_SYS_NO IN (SELECT MIN(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS WHERE NJA_RES_SYS_NO IN
(SELECT MAX(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS WHERE SYSDATE=SYSDATE-1)
Thanks!
ScottThanks here is thus far what I have, focusing on the sql script part which is the trickiest:
-- writedate.sql script for njas
SELECT NJA_RES_SYS_NO||','||NJA_TEST_REC_NO||','||NJA_LIC_ST_ID||','||NJA_ETS_ID||','||NJA_SW_VER||','||NJA_TECH_ID||','||NJA_VIN||','||NJA_LIC_NO||','
||NJA_LIC_JUR||','||NJA_LIC_SRC||','||NJA_MODEL_YR||','||NJA_MAKE||','||NJA_MODEL||','||NJA_VHCL_TYPE||','||NJA_BODY_STYLE||','||NJA_CERT_CLASS||','||
NJA_GVWR||','||NJA_ASM_ETW||','||NJA_ETW_SRC||','||NJA_NO_OF_CYL||','||NJA_ENG_SIZE||','||NJA_TRANS_TYPE||','||NJA_DUAL_EXH||','||NJA_FUEL_CD||','
|| NJA_VID_SYS_NO||','|| NJA_VRT_REC_NO||','|| NJA_ARMSTDS_REC_NO||','|| NJA_RSN_F_N_TESTABLE||','|| NJA_DYNO_TESTABLE||','||
NJA_CURR_ODO_RDNG||','|| NJA_PREV_ODO_RDNG||','|| NJA_PREV_TEST_DT||','|| NJA_TEST_TYPE||','||
NJA_TEST_START_DT||','|| NJA_TEST_END_TIME||','|| NJA_EMISS_TEST_TYPE||','|| NJA_TEST_SEQ_NO||','
||NJA_LOW_MILE_EXEMP||','||NJA_TIRE_DRY||','|| NJA_REL_HUMID||','|| NJA_AMB_TEMP||','||NJA_BAR_PRESS||','|| NJA_HCF||','||
NJA_GAS_CAP_ADAP_AVL||','|| NJA_GAS_CAP_REPL||','|| NJA_OVERALL_GAS_CAP_RES
FROM NJAS
WHERE NJA_RES_SYS_NO IN (SELECT MIN(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS WHERE NJA_RES_SYS_NO IN
(SELECT MAX(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS, (SELECT SYSDATE-1 FROM DUAL))
=====================
Output thus far:
======================
NJA_RES_SYS_NO||','||NJA_TEST_REC_NO||','||NJA_LIC_ST_ID||','||NJA_ETS_ID||','||
4,,04-MAR-03,R,27-MAR-03,27-MAR-03,O,,N,,,,,,,,Z
10871630,5274,CIF000025,CL002901,4.13,INL004025,1B7GL22X7WS569744,VK765K,NJ,B,19
98,DODGE,DAKOTA,T,3,TIER0,5200,3750,M,06,3.9,A,N,GASO,1446865,14663,3019,,Y,4654
5,,21-MAR-03,I,21-MAR-03,21-MAR-03,O,,N,,,,,,N,N,P
How do I strip the comments from the output file? Also not sure if my subquery is performing the output correctly. Thanks.
Scott -
Help with Script created to check log files.
Hi,
I have a program we use in our organization on multiple workstations that connect to a MS SQL 2005 database on a Virtual Microsoft 2008 r2 Server. The program is quite old and programmed around the days when serial connections were the most efficient means
of connection to a device. If for any reason the network, virtual server or the SAN which the virtual server runs off have roughly 25% utilization or higher on its resources the program on the workstations timeout from the SQL database and drop the program
from the database completely rendering it useless. The program does not have the smarts to resync itself to the SQL database and it just sits there with "connection failed" until human interaction. A simple restart of the program reconnects itself
to the SQL database without any issues. This is fine when staff are onsite but the program runs on systems out of hours when the site is unmanned.
The utilization of the server environment is more than sufficient if not it has double the recommended resources needed for the program. I am in regular contact with the support for the program and it is a known issue for them which i believe they do not
have any desire to fix in the near future.
I wish to create a simple script that checks the log files on each workstation or server the program runs on and emails me if a specific word comes up in that log file. The word will only show when a connection failure has occurred.
After the email is sent i wish for the script to close the program and reopen it to resync the connection.
I will schedule the script to run ever 15 minutes.
I have posted this up in a previous post about a month ago but i went on holidays over xmas and the post died from my lack or response.
Below is what i have so far as my script. I have only completed the monitoring of the log file and the email portion of it. I had some help from a guy on this forum to get the script to where it is now. I know basic to intermediate scripting so sorry for my
crudity if any.
The program is called "wasteman2G" and the log file is located in \\servername\WasteMan2G\Config\DCS\DCS_IN\alert.txt
I would like to get the email side of this script working first and then move on to getting the restart of the program running after.
At the moment i am not receiving an error from the script. It runs and doesn't complete what it should.
Could someone please help?
Const strMailto = "[email protected]"
Const strMailFrom = "[email protected]"
Const strSMTPServer = "mrc1tpv002.XXXX.local"
Const FileToRead = "\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\alert.txt"
arrTextToScanFor = Array("SVR2006","SVR2008")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set oFile = objFSO.GetFile(FileToRead)
dLastCreateDate = CDate(WshShell.RegRead("HKLM\Software\RDScripts\CheckTXTFile\CreateDate"))
If oFile.DateCreated = dLastCreateDate Then
intStartAtLine = CInt(WshShell.RegRead("HKLM\Software\RDScripts\CheckTXTFile\LastLineChecked"))
Else
intStartAtLine = 0
End If
i = 0
Set objTextFile = oFile.OpenAsTextStream()
Do While Not objTextFile.AtEndOfStream
If i < intStartAtLine Then
objTextFile.SkipLine
Else
strNextLine = objTextFile.Readline()
For each strItem in arrTextToScanFor
If InStr(LCase(strNextLine),LCase(strItem)) Then
strResults = strNextLine & vbcrlf & strResults
End If
Next
End If
i = i + 1
Loop
objTextFile.close
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\FileChecked", FileToRead, "REG_SZ"
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\CreateDate", oFile.DateCreated, "REG_SZ"
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\LastLineChecked", i, "REG_DWORD"
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\LastScanned", Now, "REG_SZ"
If strResults <> "" Then
SendCDOMail strMailFrom,strMailto,"VPN Logfile scan alert",strResults,"","",strSMTPServer
End If
Function SendCDOMail( strFrom, strSendTo, strSubject, strMessage , strUser, strPassword, strSMTP )
With CreateObject("CDO.Message")
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
.Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic
.Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = strUser
.Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strPassword
.Configuration.Fields.Update
.From = strFrom
.To = strSendTo
.Subject = strSubject
.TextBody = strMessage
On Error Resume Next
.Send
If Err.Number <> 0 Then
WScript.Echo "SendMail Failed:" & Err.Description
End If
End With
End FunctionThankyou for that link, it did help quite a bit. What i wanted was to move it to csript so i could run the wscript.echo in commandline. It all took to long and found a way to complete it via Batch. I do have a problem with my script though and you might
be able to help.
What i am doing is searching the log file. Finding the specific words then outputting them to an email. I havent used bmail before so thats probably my problem but then im using bmail to send me the results.
Then im clearing the log file so the next day it is empty so that when i search it every 15 minutes its clean and only when an error occurs it will email me.
Could you help me send the output via email using bmail or blat?
@echo off
echo Wasteman Logfile checker
echo Created by: Reece Vellios
echo Date: 08/01/2014
findstr "SRV2006 & SRV2008" \\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt > c:\log4mail.txt
if %errorlevel%==0 C:\Documents and Settings\rvellios\Desktop\DCS Checker\bmail.exe -s mrc1tpv002.xxx.local -t [email protected] -f [email protected] -h -a "Process Dump" -m c:\log4mail.txt -c
for %%G in (\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt) do (copy /Y nul "%%G")
This the working script without bmail
@echo off
echo Wasteman Logfile checker
echo Created by: Reece Vellios
echo Date: 08/01/2014
findstr "SRV2006 & SRV2008" \\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt > C:\log4mail.txt
if %errorlevel%==0 (echo Connection error)
for %%G in (\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt) do (copy /Y nul "%%G")
I need to make this happen:
If error occurs at "%errorlevel%=0" then it will output the c:\log4mail.txt via smtp email using bmail. -
Help with scripting: need to import Excel files into PS type layers
Howdy all,
I have a series of TV commercials provided to me as layered PS files. I work in CS3 and export to Avid for editing.
For customization, I need to import their Excel list of phone numbers and duplicate each one into a type layer with existing efx and placement.
There are 30-60 #s, which appear in 2 locations, so automation is key (just finished a 45 # series, and they have more!)
I dont know how to script this, and would appreciate any guidance. I am not asking for someone to do it for me, just help me learn what I have to do.
Dave KoslowFrom Excel save your file out as either CSV or TDT from the drop down 'save as' options. Once you have a plain text file script will be able to read the text file using which ever delimiter best suits you and create an array of string variables that you can use within photoshop to assign to the contents of a text layer…
Maybe you are looking for
-
Need Dynamic Table in JSP page
Hi Friends, I need to build table dynamically in my JSP page. My requirement like: I have a Button in my JSP page when i click that it should go to another jsp where it will ask me the row and column counts, after i entered some values then i have a
-
Problem Installing Trial of Photoshop CS5 extended edition
I have been trying to install cs5 extended from the adobe website. people keep telling me that my problem is my computer doesn't meet the system requirements but I have checked them and it does. Also my sister has the exact same computer and she had
-
GET_BUSINESS_SYSTEM_ERROR :- (LD_ERROR)
HI All, when i am trying fetching the data from legacy system in EPR i am getting this error .... GET_BUSINESS_SYSTEM_ERROR An error occurred when determining the business system (LD_ERROR) middleware is PI 7.1 & ERP 6.0.... SLDCHECK is also working
-
Urgent: read pdfs from network path?
Hi friends, I have a probem: When I try to read a pdf (which is in a local network path) my applicattion does it ok only if I've logged on windows as administrator user in my PC, but it doesn't work if I try to log with another user... Any idea? Can
-
Tengo un iPhone 4 y no puedo no descargar ni actualizar las apps
No puedo descargar ni actualizar apps, que puedo hacer?