Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I am trying to limit the number of records that I import in Edit Script by using a date variable.
One table has one record with a date field which I want to use as the variable . The other table has the records.
Table with date record:
LOAD date,
Module;
SQL SELECT *
FROM live where Module = 'db';
The code with the variable is below:
LOAD
date,
debtor,
amt;
SQL SELECT
date,
debtor,
amt
From debtor_table where date >= 'variable';
Is it possible to link the variable to a value that is retrieved in earlier script from a different table?
I notice that there are some system variable names for dates - can I use them as the variable instead?
Regards
Yes, something like this for example. You will need to make sure that the variable gets the same date format as the date field in your second table has.
T1:
LOAD date,
Module;
SQL SELECT *
FROM live where Module = 'db';
LET vDate = peek('date'); //pick the date value from the last record of table T1
T2:
LOAD
date,
debtor,
amt;
SQL SELECT
date,
debtor,
amt
From debtor_table where date >= '$(vDate)';
Instead of that u can change both fields as same date format(i.e 'YYYY-MM-DD') then keep as same name to both fields then give the association.
Yes, something like this for example. You will need to make sure that the variable gets the same date format as the date field in your second table has.
T1:
LOAD date,
Module;
SQL SELECT *
FROM live where Module = 'db';
LET vDate = peek('date'); //pick the date value from the last record of table T1
T2:
LOAD
date,
debtor,
amt;
SQL SELECT
date,
debtor,
amt
From debtor_table where date >= '$(vDate)';
Hi,
Perhaps, you can try something like this:
TableWithDateRecord:
Load * Inline
[
DateField
1/4/2013
];
Let datevariable=('DateField',-1,'TableWithDateRecord');
OtherTable:
Load * Inline
[
Key,Value,Date
A,10,1/3/2012
B,20,1/2/2013
C,30,1/12/2013
D,40,1/4/2013
E,40,2/4/2013
]
;
Load *
Resident OtherTable
where Date <$(datevariable);
Regards,
-Khaled
Thanks Gysbert
I have used coding in Access before but QV is different.