FDM SCRIPTING - MID Function
I need to trim the values of a column based on the position of characters like below.
Original
Trimed Output
New York [1000]
1000
London [12001]
12001
Paris [45]
45
I use the below syntax. But it gives me an error : 5 - Invalid procedure call or argument
getProjetIDN =Mid(strField,InStr(strField,"[")+1,Len(strField)-1)
It works fine if i remove the '-1' from len command. And it works for '+1 as well. Can anyone help me with a way around?
getProjetIDN =Mid(strField,InStr(strField,"[")+1,Len(strField)) --> Works fine
getProjetIDN =Mid(strField,InStr(strField,"[")+1,Len(strField)+1) --> Works fine
Somehow for '-1' , it is giving me an error.
Thank you.
Thank you for your response
I have made it this way. and it works fine.
dim value1
dim value2
dim value3
value1 =InStr(strField,"[")+1
value2 =InStr(strField,"]")
value3 =Mid(strField,value1,value2)
getProjetIDN = DW.Utilities.fParseString(value3, 1, 1, "]")
Similar Messages
-
Logic script invalid function mid()
Hi Expert
Can i use mid() function in the logic script like:
*Rec(FACTOR=1,Location=mid(ENTITY.Loc,3,20))
I do try, but it store "mid(ENTITY.Loc,3,20)" to my database.
any idea how to achieve this.
Thanks.Hi Guik,
I think the best way to achieve this would be by following these steps:
1. Add an additional property to your Entity dimension which would contain the value of the MID function. This would be there for all ID's
2. In your script logic you would need to use the Lookup function that would be able to lookup this property using the actual ID
Hope this helps!
Santosh -
FDM Script - Set to run at a specific time of day??
Can you set an FDM script to run at a certain time of day (based on
server time)? I've currently got a Custom/General script I'd like to
run once a day at a set time.
Thanks!You need the use task manager for that.
I suggest you look in the admin guide for more info.
If I’m not mistaken, you need to enable in the application setting and then you can use it from the tools menu in the Workbench. -
What is the Java equivalent of Visual BAsic ASC() and MID() functions
Hello all! I just would like to ask if you have any idea on how to convert the VB ASC() and MID() functions into java. Where:
1. ASC( ) Function - Returns the ANSI value for the leftmost character in a character expression.
2. MID() Function - The Mid method extracts a substring of length nCount characters from a CHString string, starting at position nFirst (zero-based). The method returns a copy of the extracted substring.
I would really appreciate your help. Thanx!ah yeah! sorry typo error. see, I am converting a VB method that encrypts password:
Function EncryptText(ByVal stDecryptedText As String)
Dim stText As String, lngCounter As Long
Dim iTemp As Integer, lngNumber As Long
lngCounter = 1
lngNumber = 8
Do Until lngCounter = Len(stDecryptedText) + 1
iTemp = Asc(Mid(stDecryptedText, lngCounter, 1))
If lngCounter Mod 2 = 0 Then
iTemp = iTemp - lngNumber
Else
iTemp = iTemp + lngNumber
End If
iTemp = iTemp Xor (10 - lngNumber)
stText = stText & Chr$(iTemp)
lngCounter = lngCounter + 1
Loop
EncryptText = stText
End Function
I converted this function into this:
public static String encryptPass(String password) {
String encpwd = "";
int iTemp = 0;
final int lngNumber = 8;
String stText = "";
for ( int i = 0; i < password.length() ; i++ ) {
iTemp = Character.getNumericValue(password.charAt(i));
if ( i % 2 == 0 ) {
iTemp = iTemp - lngNumber;
} else {
iTemp = iTemp + lngNumber;
iTemp = iTemp ^ (10 - lngNumber);
char c = Character.forDigit(iTemp,Character.MAX_RADIX);
encpwd = encpwd + String.valueOf(c);
return encpwd;
But I'm having trouble with the encryption because it returns a different set of characters. Did I convert it right? thanx. -
FDM Scripting Query for last imported source file using Batch Processing
Hi Experts,
I'm currently in the processing of automating the FDM load process on our version of FDM 9.3.3 using batch processing and the FDM Task Manager. Most of the process works fine including an email alert which notifies users of when a data load has taken place.
As part of that email alert I am trying to attach the source file that has been loaded in batch processing. I have managed to get an attachment using the following FDM Script Object of:
"API.MaintenanceMgr.fPartLastFile(strLoc, True, False)".
But have noticed that using this only attaches the last "manually" imported file rather than the last file imported using the batch processing.
My question is: Is it possible for someone to steer me into the right direction of either a more appropriate API or if I have missed a step in my script.
Any help as always would be much appreciated.
Cheers
PipUnfortunately the batch process does not work the same way as on-line. I am assuming you are using the normal batch load and not Multiload (although the batch is simisar).
the batch file name gets recorded on the tBatchContents table, and moved to the import/batches folder under the folder for the current batch run. However, if successful the file gets deleted (and from memory does not get archived). To add the import file to the e-mail, after a successful load, i think you will need to store a copy of it prior to importing the file. -
Left Right Mid Functions, make new row and Merge
Hello -
I don't know if this is possible or not, but I have data that is structured like the following:
Model
Amount
5541 AAA/BBB/CCC
5.96
4000 DDD/EEE
8.98
204
7.32
701 AAA
8.93
I need to compare it with a table I have in my database that has Model and Account columns. The data in my database is structured like:
Model
Amount
5541CEAAA
4.98
5541BEBBB
4.99
5541ABCCC
3.98
4000CEDDD
2.25
4000DEEEE
7.01
204
7.01
701 AAA
7.03
I would like to use Merge to compare the two tables to update the Amount column. I need to get the Model column in a state where I can do that. I somehow think maybe the Right, Left, Mid functions can help separate out the data, but I would think
also that it needs to be separated and put in another row.
Any help will be greatly appreciated!
JuniormintHi Satheesh -
Thanks for your response. The expected results are that the new Amounts from the first table are updated in the second table as follows:
Model
Amount
5541CEAAA
5.96
5541BEBBB
5.96
5541ABCCC
5.96
4000CEDDD
8.98
4000DEEEE
8.98
204
7.32
701 AAA
8.93
Sorry I was unclear!
Juniormint -
Hi,
I'm new to FDM scripting. So any pointers will be appreciated. I need to import a TB with the following format in exel file.
row1 ***CostCenter Number***
row2 ***TB name*
row3 - Other parameters
row4 - Blank
row5 - Data headers
row6 - Data begins - format given below -
row7 - Account Desc Opening Bal Closing Bal
I have created an import format with the 4 fields - CostCentre, Account,Desc and closing bal. Now my question is -
1. How do i create script that picks the costcenter number from row1 ?
Thanks in Advance!!That format will not work in an excel file, FDM requires a specific excel template, also the FDM excel templates do not use import scripts,so first convert to a csv file.
You will then need to use a temporary variable for this e.g. RES.PvarTemp1 and create 2 import scripts
Assuming that cost centre is the only value on line one of the file what you need to do is:
Attach an Import script to the Amount entry in your import format and put in the following code (this assumes cost centre is always the first header line and your script is called GetCostCentre)
If Not Len(RES.PvarTemp1) > 0 Then
RES.PvarTemp1 = DW.Utilities.fParseString(strRecord,4,1,",")
End If
GetCostCentre = strField
Attach an import script to the CostCentre entry in the import format called SetCostCentre, it will have one line
SetCostCentre = RES.PvarTemp1
There is a very similar example in the FDM admin guide Scripting cahpter which has a bit more description.
Edited by: SH on Dec 7, 2012 11:17 AM -
VMware PowerCli PowerShell Script - Stack Functions
Using this as a starting block.
http://pubs.vmware.com/view-52/index.jsp?topic=%2Fcom.vmware.view.integration.doc%2Fview_integration_powershell.5.7.html
I want to combine two of the functions, and have the variables use ".txt" files with my new and old datastores listed.
I've edited it a bit, combining the two functions, and creating variables for new and old lists, but I'm not sure if the context I used is correct, or if I can just paste the functions together like this.
Before I run this against my VMware View Connection server, anything stand out as wrong?
# A PowerShell function to add new, then remove old datastores from an automatic pool.
# UpdateDatastoresForAutomaticPool
# Parameters
# $Pool Pool ID of pool to be updated.
# $OldDatastore Full path to OldDatastore.txt to be removed.
# $NewDatastore Full path to NewDatastore.txt to be added.
$Pool = "C:\powercli\PersistentPools.txt"
$OldDatastore = "C:\powercli\OldDatastore.txt"
$NewDatastore = "C:\powercli\NewDatastore.txt"
function RemoveDatastoreFromAutomaticPool
{ param ($Pool, $OldDatastore)
$PoolSettings = (Get-Pool -pool_id $Pool)
$currentdatastores = $PoolSettings.datastorePaths
$datastores = ""
foreach ($path in $currentdatastores.split(";")){
if(-not ($path -eq $OldDatastore)){
$datastores = $datastores + "$path;"
Update-AutomaticPool -pool_id $Pool -datastorePaths $datastores
function AddDatastoreToAutomaticPool
{ param ($Pool, $NewDatastore)
$PoolSettings = (Get-Pool -pool_id $Pool)
$datastores = $PoolSettings.datastorePaths + ";$NewDatastore"
Update-AutomaticPool -pool_id $Pool -datastorePaths $datastores
Thanks,
-Matt
There's no place like 127.0.0.1Other than the specific commandlets of "Update-AutomaticPool -pool_id -datastorePaths", this is PowerShell script, right?
I'm not looking for support for the functions themselves. But VMware only gives these scripts as individual functions.
I want to stack their functions one after another in a script, and use text files with lists of data, instead of specifying them one at a time to the script.
Function 1 as supplied by VMware
Define a PowerShell function to add a datastore to an automatic pool.
# AddDatastoreToAutomaticPool
# Parameters
# $Pool Pool ID of pool to be updated.
# $Datastore Full path to datastore to be added.
function AddDatastoreToAutomaticPool
{ param ($Pool, $Datastore)
$PoolSettings = (Get-Pool -pool_id $Pool)
$datastores = $PoolSettings.datastorePaths + ";$Datastore"
Update-AutomaticPool -pool_id $Pool -datastorePaths $datastores
Function 2 as supplied by VMware
Define a PowerShell function to add a datastore to an automatic pool.
# AddDatastoreToAutomaticPool
# Parameters
# $Pool Pool ID of pool to be updated.
# $Datastore Full path to datastore to be added.
function AddDatastoreToAutomaticPool
{ param ($Pool, $Datastore)
$PoolSettings = (Get-Pool -pool_id $Pool)
$datastores = $PoolSettings.datastorePaths + ";$Datastore"
Update-AutomaticPool -pool_id $Pool -datastorePaths $datastores
I'm just looking for advise as to weather I'm approaching this from the right angle.
In my original post I made an attempt at pasting them together, then editing the parameter lines to use a text file instead of supplying an individual entry on the cmd line with the script. I think I did it right, but I'm not sure if the way these
functions are written, that they will parse through each of the text files.
Thanks,
-Matt
There's no place like 127.0.0.1 -
Need the opposite of the Mid function for String fields
My report has a field for last name and I only want the first 14 letters of each last name to show on the report. I figured out how to show the letters beyond 14 using the Mid function. Is there a function to show the first 14 (ie., the opposite of the Mid function)?
Hi Shannyn,
Use this formula:
Left(,14)
This will give you the first 14 letters of each last name field.
I hope this helps.
Regards,
Zack H. -
FDM - scripting variable for reversing the account
Is there somehow a possibility to tell if the account is intended to be reversed or not (e.g. change the type from revenue to expense). I'm looking for a specific variable that you can use in scripting. I looked through the API guide, but didn't find this information. I rather not look at the tables, but I will if I have to.
I'm using the pull adapter G-3-J in FDM 11.1.1.1.0 and file I have data for multiple periods in the source. I'm storing some of the amounts into the user defined dimensions and I need to be able the change the sign on these if the account type is changed (e.g. from revenue to expense).Yes and I would like to reuse the information if the box is ticked or not in order to the change the sign for user defined dimensions 9 - 19, as explained in the first message.
Is it somehow possible using predefined functions / scripts or do you have to make a custom script? -
FDM - Account by Functional Area (Production and Sales)
I have assigned an import script in C4 to with an "S" or "P" based on the Functional Area field. I want to now suffix this to the Account which i can then use in the Explict Map. Does anyone know what the Account script needs to be to pick up the result of C4?
You will need to do a couple things:
1) Change the processesing order of the dimensions. This is done in the Dimensions metadata by explicitly defining an order of the dimensions using the Calc Sequence. i.e. ensure the C4 dimension has a lower number in the calc sequence column than account.
2) In the C4 import script aswell as returning the value from the function "S" or "P" make sure you assign the return value to a FDM Temporary variable e.g. RES.PvarTemp1
3) Add an import script to the account dimension in it suffix the account code with the the value held in the temp variable. -
Hi,
I'm trying FDM custom script to copy records from text file to oracle database.
I've created 'sample' table in database.
when I try to open table in script I get 'Arguments are of wrong type or out of acceptable range"
Below is the statement where I am receiving error:
*+Set rs = cnSS.OpenRecordSet("sample")+*
Below is the logic:
*+Set cnSS = CreateObject("ADODB.Connection")+*
*+Set rs = CreateObject("ADODB.Recordset")+*
*+strFile = "D:\Toload.txt"+*
*+cnss.open "Provider=xxxxx;Data Source=xxxxx;User ID=xxxx;Password=xxxx"+*
*+Set rs = cnSS.OpenRecordSet("sample")+*
*+Set fso = CreateObject("Scripting.FileSystemObject")+*
*+If fso.FileExists(strFile) Then+*
*+Set Objfso = fso.OpenTextFile(strFile, 1, False)+*
*+Do While Objfso.AtEndofStream <> True+*
*+rs.Addnew+*
*+For i = 0 To Objfso.Fields.Count - 1+*
*+On Error Resume Next+*
*+rs.Fields(i) = Objfso.Fields (i)+*
*+Next+*
*+rs.Update+*
*+Objfso.MoveNext+*
*+Loop+*
*+Objfso.Close+*
*+Set fso=Nothing+*
*+End If+*
Please let me know if I'm missing something.
Thanks in advance
Edited by: 995155 on Mar 29, 2013 10:43 AM
Edited by: 995155 on Mar 29, 2013 10:44 AMI may be on the wrong trail here, but the method you are using i think is related to Microsoft DAO. However, you initial definitions relate to ADO.
It is not a technique i have seen used with FDM as i am used to using ADO and using the standard SQL options such as Select, Insert etc. -
HI Experts,
I will get VBELN as an import parameter in my Z-FM.
Now i have to pass this VBELN to RVORDER01 script and to finally get the OTF data from CLose_form.
How to sap script processing in function module
Thanks
ChandraExample
Definition in the SAPscript form:
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/ &BARCODE&
Coding of the calling ABAP program:
REPORT QCJPERFO.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA: PAGNUM LIKE SY-TABIX, "page number
NEXTPAGE LIKE SY-TABIX. "number of next page
READ TABLE IN_PAR WITH KEY u2018PAGEu2019.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY u2018NEXTPAGEu2019.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY u2018BARCODEu2019.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = u2018|u2019. "First page
ELSE.
OUT_PAR-VALUE = u2018||u2019. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = u2018Lu2019. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM. -
Script or function for flipped images
Hi
My team is an in-house creative team on a MAC environment. We do our own preflighting. From time to time vendors send us backward images. Some slip through the cracks before placing them in InDesign and we have to manually inspect each image before sending to a print vendor. Is there a script or an InDesign function that checks for this?
Thanks,
Johnny_BigtimeThis sets the flip of every link and its frame to none. Note that the flip is relative to the Transform Panel's Reference Point
tell application "Adobe InDesign CS5.5"
tell active document
set IDLinks to links
repeat with myCounter from 1 to count IDLinks
set absolute flip of parent of item myCounter of IDLinks to none
set absolute flip of parent of parent of item myCounter of IDLinks to none
end repeat
end tell
end tell -
Hi Friends
We currently load data into essbase through FDM. After the data is loaded we are running the Essbase calc manually which we want to automate.
Can some one please help me with the script which can be incorporated within FDM which will call for the calc after the data is loaded.
Thanks in advance for your help.
Regards
MuraliActually if you want to set off a calculation in Essbase using FDM, this is how you do it:
1. Under Integration settings enable consolidation
2. For Default Calculation Method under integration settings choose file
3. Create a validation entity for your Essbase location
4. Where it says Parent Entity put in the exact name of your calc script ie CalcDB
5. For Entity I always have put the top level member Entity
6. Check the consolidate box
7. Start period is 0
8. Type - All
9. Sequence 0
10. Assign this validation entity to your essbase location.
Maybe you are looking for
-
How do I STOP the headphones from turning on iPod app?
If you press the mic jack on the iPhone headphones, it starts the iPod app playing. Nice, if you want to listen to music. Irritating, if it goes off in your pocket. How do I STOP the mic from turning on the iPod app?
-
How to override the functionality of a method which is embedded in an swf
Hi, I have an swf for my application for which i do not have the source code. Now i want to override the functionality of a method (say doIt()) in a class (say MyClass.as). Is there any way to achieve the classloader functionality that similar to the
-
How to get TOP 5 results in version 7.3.4?
Hello, I have try to use subquery in a query to get the top 5 result in Oracle version 7.3.4, it seems like not working. Can you please tell me how to get the TOP 5 results with Oracle 7.3.4?? For example, REJECT CATEGORY QUANTITY AA 100 BB 5 CC 20 D
-
ERROR: invalid http connection : ADS
I am a beginner in ADOBE forms . After creating the context and the data view when i tried to activate it its showing "invalid http connection : ADS". Please help ....................................
-
Business area missing in documents
Hi I have few documents which are posted with out Business Area is there any solution, other than reversing the document and post, hence these documents are belong to previous year. Regards, Bhaskar