Hi everyone,
Is there a way to make a string such as
myString := '{||oDataSetGENERIC:FieldGet("' + variableWithEverChangingValue + '")}'
into a code block so I can put this into a DCFINDADDCOL DATA parameter like so
DCFINDADDCOL DATA myString HEADER 'PERIOD' TO COL_TABLE ??
string to code block
Re: string to code block
Code: Select all
myString := '{||oDataSetGENERIC:FieldGet("' + variableWithEverChangingValue + '")}'
bBlock := &myString
The eXpress train is coming - and it has more cars.
-
- Posts: 103
- Joined: Fri Sep 17, 2010 2:58 am
Re: string to code block
Hi Roger,rdonnay wrote:Code: Select all
myString := '{||oDataSetGENERIC:FieldGet("' + variableWithEverChangingValue + '")}' bBlock := &myString
Thanks for the reply.
Using your code does indeed made it into a code block but also returned the value of the code block. So the values inside the field (AMOUNT in this case) is always the value of the first row of the DataSet
Please take a look at the image attached for a better view of the problem. Hardcoded field is how the field finally should look like.
Code: Select all
xFieldName := 'AMOUNT'
myString := '{||oDataSetGENERIC:FieldGet("' + xFieldName + '")}'
bBlock := &myString
DCFINDADDCOL DATA {||oDataSetGENERIC:FieldGet('PERIOD')} HEADER 'FIELD1' TO COL_TABLE
DCFINDADDCOL DATA {||oDataSetGENERIC:FieldGet('BATNO')} HEADER 'FIELD2' TO COL_TABLE
DCFINDADDCOL DATA {||oDataSetGENERIC:FieldGet('VOUCH')} HEADER 'FIELD3' TO COL_TABLE
DCFINDADDCOL DATA {||oDataSetGENERIC:FieldGet('ACNO')} HEADER 'FIELD4' TO COL_TABLE
DCFINDADDCOL DATA {||oDataSetGENERIC:FieldGet('DESC')} HEADER 'FIELD5' TO COL_TABLE
DCFINDADDCOL DATA {||oDataSetGENERIC:FieldGet(xFieldName)} HEADER 'Hardcoded' TO COL_TABLE
DCFINDADDCOL DATA bBlock HEADER 'From Forum' TO COL_TABLE
@1,1 DCFINDBROWSE FIELDS COL_TABLE DATA oDataSetGENERIC SIZE x1024+100,y1024+18 AUTOSEEK TITLE XTITLE FONT cSAYFONT TO xSELECT
- Attachments
-
- Untitled-1.gif (10.06 KiB) Viewed 10151 times
Re: string to code block
Andy -
I don't know why yours doesn't work. It looks right to me.
Compile and run the below code.
It works as expected.
Use CUSTOMER.DBF from \exp19\data
Roger
I don't know why yours doesn't work. It looks right to me.
Compile and run the below code.
It works as expected.
Use CUSTOMER.DBF from \exp19\data
Roger
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main
LOCAL GetList[0], GetOptions, oBrowse, cFieldName, cField, bField
USE CUSTOMER
@ 0,0 DCBROWSE oBrowse ALIAS 'CUSTOMER' SIZE 10,20 FIT
DCBROWSECOL DATA {||CUSTOMER->bill_name} HEADER 'Name 1' WIDTH 15 PARENT oBrowse
cFieldName := 'bill_name'
cField := '{||CUSTOMER->' + cFieldName + '}'
bField := &cField
DCBROWSECOL DATA bField HEADER 'Name 2' WIDTH 15 PARENT oBrowse
DCREAD GUI FIT TITLE 'Macro test'
RETURN nil
PROC appsys ; return
The eXpress train is coming - and it has more cars.
-
- Posts: 103
- Joined: Fri Sep 17, 2010 2:58 am
Re: string to code block
Just an update, that the problem went away after a system restart. 
